From ac388f2a39904e6d7b48727a42e78e0bb18be430 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Thu, 20 Mar 1997 21:23:10 +0000 Subject: [PATCH] Based on patches from Philippe De Muyter . * coff-svm68k.c: New file. Just defines some macros and includes coff-m68k.c. * coff-m68k.c: Add functions to handle common addends, moved in from cf-m68klynx.c. Control them using COFF_COMMON_ADDEND macro. Control whether relocs are visible using STATIC_RELOCS. * cf-m68klynx.c: Simplify greatly: just define macros to control coff-m68k.c. * coff-aux.c: Likewise. Just leave add_one_symbol routine. * targets. (m68ksysvcoff_vec): Declare. (bfd_target_vector): Add m68ksysvcoff_vec. * config.bfd (m68*-motorola-sysv*): New target. * configure.in (m68ksysvcoff_vec): New vector. * configure: Rebuild. * Makefile.in: Rebuild dependencies. (BFD32_BACKENDS): Add coff-svm68k.o. (BFD32_BACKENDS_CFILES): Add coff-svm68k.c. --- bfd/.Sanitize | 1 + bfd/ChangeLog | 18 ++ bfd/Makefile.in | 8 +- bfd/cf-m68klynx.c | 204 +--------------- bfd/coff-svm68k.c | 26 ++ bfd/config.bfd | 11 +- bfd/configure | 606 ++++++++++++++++++++++++++++++++-------------- bfd/configure.in | 5 +- bfd/targets.c | 146 ++++++++--- 9 files changed, 598 insertions(+), 427 deletions(-) create mode 100644 bfd/coff-svm68k.c diff --git a/bfd/.Sanitize b/bfd/.Sanitize index 1d57cfc1abe..22b0825c41f 100644 --- a/bfd/.Sanitize +++ b/bfd/.Sanitize @@ -117,6 +117,7 @@ coff-ppc.c coff-rs6000.c coff-sh.c coff-sparc.c +coff-svm68k.c coff-u68k.c coff-we32k.c coff-w65.c diff --git a/bfd/ChangeLog b/bfd/ChangeLog index a15997d2733..5c0b69d795e 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,5 +1,23 @@ Thu Mar 20 12:39:02 1997 Ian Lance Taylor + Based on patches from Philippe De Muyter . + * coff-svm68k.c: New file. Just defines some macros and includes + coff-m68k.c. + * coff-m68k.c: Add functions to handle common addends, moved in + from cf-m68klynx.c. Control them using COFF_COMMON_ADDEND macro. + Control whether relocs are visible using STATIC_RELOCS. + * cf-m68klynx.c: Simplify greatly: just define macros to control + coff-m68k.c. + * coff-aux.c: Likewise. Just leave add_one_symbol routine. + * targets. (m68ksysvcoff_vec): Declare. + (bfd_target_vector): Add m68ksysvcoff_vec. + * config.bfd (m68*-motorola-sysv*): New target. + * configure.in (m68ksysvcoff_vec): New vector. + * configure: Rebuild. + * Makefile.in: Rebuild dependencies. + (BFD32_BACKENDS): Add coff-svm68k.o. + (BFD32_BACKENDS_CFILES): Add coff-svm68k.c. + * binary.c (binary_set_section_contents): Don't get misled if the first section is not loadable. From Matthew L. Martin . diff --git a/bfd/Makefile.in b/bfd/Makefile.in index 628e82087d9..c5ada4f292a 100644 --- a/bfd/Makefile.in +++ b/bfd/Makefile.in @@ -205,6 +205,7 @@ BFD32_BACKENDS = \ coff-rs6000.o \ coff-sh.o \ coff-sparc.o \ + coff-svm68k.o \ $(start-sanitize-tic80) \ coff-tic80.o \ $(end-sanitize-tic80) \ @@ -315,6 +316,7 @@ BFD32_BACKENDS_CFILES = \ coff-rs6000.c \ coff-sh.c \ coff-sparc.c \ + coff-svm68k.c \ coff-u68k.c \ coff-we32k.c \ coff-w65.c \ @@ -1015,6 +1017,9 @@ coff-sh.o: coff-sh.c $(INCDIR)/bfdlink.h $(INCDIR)/coff/sh.h \ $(INCDIR)/coff/internal.h libcoff.h coffcode.h coffswap.h coff-sparc.o: coff-sparc.c $(INCDIR)/coff/sparc.h $(INCDIR)/coff/internal.h \ libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h +coff-svm68k.o: coff-svm68k.c coff-m68k.c $(INCDIR)/coff/m68k.h \ + $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h \ + coffcode.h coffswap.h coff-u68k.o: coff-u68k.c coff-m68k.c $(INCDIR)/coff/m68k.h \ $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h \ coffcode.h coffswap.h @@ -1033,7 +1038,8 @@ ecoff.o: ecoff.c $(INCDIR)/bfdlink.h $(INCDIR)/aout/ar.h \ libcoff.h libecoff.h ecofflink.o: ecofflink.c $(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 + $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h $(INCDIR)/coff/ecoff.h \ + libcoff.h libecoff.h elf32-gen.o: elf32-gen.c elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ elf32-target.h diff --git a/bfd/cf-m68klynx.c b/bfd/cf-m68klynx.c index 6425c3013e7..7674f1b248b 100644 --- a/bfd/cf-m68klynx.c +++ b/bfd/cf-m68klynx.c @@ -1,5 +1,5 @@ /* BFD back-end for Motorola M68K COFF LynxOS files. - Copyright 1993, 1994, 1995, 1996 Free Software Foundation, Inc. + Copyright 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc. Written by Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -20,207 +20,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define TARGET_SYM m68klynx_coff_vec #define TARGET_NAME "coff-m68k-lynx" - #define LYNXOS - #define COFF_LONG_FILENAMES - -#define _bfd_m68kcoff_howto_table _bfd_m68klynx_howto_table -#define _bfd_m68kcoff_rtype2howto _bfd_m68klynx_rtype2howto -#define _bfd_m68kcoff_howto2rtype _bfd_m68klynx_howto2rtype -#define _bfd_m68kcoff_reloc_type_lookup _bfd_m68klynx_reloc_type_lookup - -#define LYNX_SPECIAL_FN _bfd_m68klynx_special_fn - -#include "bfd.h" -#include "sysdep.h" - -#ifdef ANSI_PROTOTYPES -struct internal_reloc; -struct coff_link_hash_entry; -struct internal_syment; -#endif - -static bfd_reloc_status_type _bfd_m68klynx_special_fn - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); -static reloc_howto_type *coff_m68k_lynx_rtype_to_howto - PARAMS ((bfd *, asection *, struct internal_reloc *, - struct coff_link_hash_entry *, struct internal_syment *, - bfd_vma *)); - -/* For some reason when using m68k COFF the value stored in the .text - section for a reference to a common symbol is the value itself plus - any desired offset. (taken from work done by Ian Taylor, Cygnus Support, - for I386 COFF). */ - -/* If we are producing relocateable output, we need to do some - adjustments to the object file that are not done by the - bfd_perform_relocation function. This function is called by every - reloc type to make any required adjustments. */ - -static bfd_reloc_status_type -_bfd_m68klynx_special_fn (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message; -{ - symvalue diff; - - if (output_bfd == (bfd *) NULL) - return bfd_reloc_continue; - - if (bfd_is_com_section (symbol->section)) - { - /* We are relocating a common symbol. The current value in the - object file is ORIG + OFFSET, where ORIG is the value of the - common symbol as seen by the object file when it was compiled - (this may be zero if the symbol was undefined) and OFFSET is - the offset into the common symbol (normally zero, but may be - non-zero when referring to a field in a common structure). - ORIG is the negative of reloc_entry->addend, which is set by - the CALC_ADDEND macro below. We want to replace the value in - the object file with NEW + OFFSET, where NEW is the value of - the common symbol which we are going to put in the final - object file. NEW is symbol->value. */ - diff = symbol->value + reloc_entry->addend; - } - else - { - /* For some reason bfd_perform_relocation always effectively - ignores the addend for a COFF target when producing - relocateable output. This seems to be always wrong for 386 - COFF, so we handle the addend here instead. */ - diff = reloc_entry->addend; - } - -#define DOIT(x) \ - x = ((x & ~howto->dst_mask) | (((x & howto->src_mask) + diff) & howto->dst_mask)) - - if (diff != 0) - { - reloc_howto_type *howto = reloc_entry->howto; - unsigned char *addr = (unsigned char *) data + reloc_entry->address; - - switch (howto->size) - { - case 0: - { - char x = bfd_get_8 (abfd, addr); - DOIT (x); - bfd_put_8 (abfd, x, addr); - } - break; - - case 1: - { - short x = bfd_get_16 (abfd, addr); - DOIT (x); - bfd_put_16 (abfd, x, addr); - } - break; - - case 2: - { - long x = bfd_get_32 (abfd, addr); - DOIT (x); - bfd_put_32 (abfd, x, addr); - } - break; - - default: - abort (); - } - } - - /* Now let bfd_perform_relocation finish everything up. */ - return bfd_reloc_continue; -} -/* Compute the addend of a reloc. If the reloc is to a common symbol, - the object file contains the value of the common symbol. By the - time this is called, the linker may be using a different symbol - from a different object file with a different value. Therefore, we - hack wildly to locate the original symbol from this file so that we - can make the correct adjustment. This macro sets coffsym to the - symbol from the original file, and uses it to set the addend value - correctly. If this is not a common symbol, the usual addend - calculation is done, except that an additional tweak is needed for - PC relative relocs. - FIXME: This macro refers to symbols and asect; these are from the - calling function, not the macro arguments. */ - -#define CALC_ADDEND(abfd, ptr, reloc, cache_ptr) \ - { \ - coff_symbol_type *coffsym = (coff_symbol_type *) NULL; \ - if (ptr && bfd_asymbol_bfd (ptr) != abfd) \ - coffsym = (obj_symbols (abfd) \ - + (cache_ptr->sym_ptr_ptr - symbols)); \ - else if (ptr) \ - coffsym = coff_symbol_from (abfd, ptr); \ - if (coffsym != (coff_symbol_type *) NULL \ - && coffsym->native->u.syment.n_scnum == 0) \ - cache_ptr->addend = - coffsym->native->u.syment.n_value; \ - else if (ptr && bfd_asymbol_bfd (ptr) == abfd \ - && ptr->section != (asection *) NULL) \ - cache_ptr->addend = - (ptr->section->vma + ptr->value); \ - else \ - cache_ptr->addend = 0; \ - if (ptr && (reloc.r_type == R_PCRBYTE \ - || reloc.r_type == R_PCRWORD \ - || reloc.r_type == R_PCRLONG)) \ - cache_ptr->addend += asect->vma; \ - } - -#define coff_rtype_to_howto coff_m68k_lynx_rtype_to_howto +#define STATIC_RELOCS +#define COFF_COMMON_ADDEND #include "coff-m68k.c" - -/* coff-m68k.c uses the special COFF backend linker. We need to - adjust common symbols. - - We can't define this function until after we have included - coff-m68k.c, because it uses RTYPE2HOWTO. */ - -/*ARGSUSED*/ -static reloc_howto_type * -coff_m68k_lynx_rtype_to_howto (abfd, sec, rel, h, sym, addendp) - bfd *abfd; - asection *sec; - struct internal_reloc *rel; - struct coff_link_hash_entry *h; - struct internal_syment *sym; - bfd_vma *addendp; -{ - arelent relent; - reloc_howto_type *howto; - - RTYPE2HOWTO (&relent, rel); - - howto = relent.howto; - - if (howto->pc_relative) - *addendp += sec->vma; - - if (sym != NULL && sym->n_scnum == 0 && sym->n_value != 0) - { - /* This is a common symbol. The section contents include the - size (sym->n_value) as an addend. The relocate_section - function will be adding in the final value of the symbol. We - need to subtract out the current size in order to get the - correct result. */ - BFD_ASSERT (h != NULL); - *addendp -= sym->n_value; - } - - /* If the output symbol is common (in which case this must be a - relocateable link), we need to add in the final size of the - common symbol. */ - if (h != NULL && h->root.type == bfd_link_hash_common) - *addendp += h->root.u.c.size; - - return howto; -} diff --git a/bfd/coff-svm68k.c b/bfd/coff-svm68k.c new file mode 100644 index 00000000000..3d2a5a7d565 --- /dev/null +++ b/bfd/coff-svm68k.c @@ -0,0 +1,26 @@ +/* BFD back-end for Motorola sysv68 + Copyright 1997 Free Software Foundation, Inc. + Written by Philippe De Muyter . + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#define TARGET_SYM m68ksysvcoff_vec +#define TARGET_NAME "coff-m68k-sysv" +#define STATIC_RELOCS +#define COFF_COMMON_ADDEND + +#include "coff-m68k.c" diff --git a/bfd/config.bfd b/bfd/config.bfd index 77f0d9bdfc3..5d1bb9e185f 100755 --- a/bfd/config.bfd +++ b/bfd/config.bfd @@ -108,11 +108,9 @@ case "${targ}" in targ_underscore=yes ;; -# start-sanitize-d10v d10v-*-*) targ_defvec=bfd_elf32_d10v_vec ;; -# end-sanitize-d10v # start-sanitize-d30v d30v-*-*) @@ -262,6 +260,9 @@ case "${targ}" in targ_defvec=m68kcoffun_vec targ_underscore=yes ;; + m68*-motorola-sysv*) + targ_defvec=m68ksysvcoff_vec + ;; m68*-hp-bsd*) targ_defvec=hp300bsd_vec targ_underscore=yes @@ -387,6 +388,10 @@ case "${targ}" in targ_defvec=ecoff_big_vec targ_selvecs=ecoff_little_vec ;; + mips*-*-lnews*) + targ_defvec=ecoff_biglittle_vec + targ_selvecs="ecoff_little_vec ecoff_big_vec" + ;; mips*-*-mach3*) targ_defvec=aout_mips_little_vec targ_cflags=-DSTAT_FOR_EXEC @@ -437,7 +442,7 @@ case "${targ}" in targ_underscore=yes ;; - powerpc-*-aix*) + powerpc-*-aix* | powerpc-*-beos*) targ_defvec=rs6000coff_vec ;; powerpc-*-elf* | powerpc-*-sysv4* | powerpc-*-eabi* | \ diff --git a/bfd/configure b/bfd/configure index 91837963c72..fbbcb0a3374 100755 --- a/bfd/configure +++ b/bfd/configure @@ -1,7 +1,7 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 2.10 +# Generated automatically using autoconf version 2.12 # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. # # This configure script is free software; the Free Software Foundation @@ -59,6 +59,8 @@ mandir='${prefix}/man' # Initialize some other variables. subdirs= MFLAGS= MAKEFLAGS= +# Maximum number of lines to put in a shell here document. +ac_max_here_lines=12 ac_prev= for ac_option @@ -340,7 +342,7 @@ EOF verbose=yes ;; -version | --version | --versio | --versi | --vers) - echo "configure generated by autoconf version 2.10" + echo "configure generated by autoconf version 2.12" exit 0 ;; -with-* | --with-*) @@ -442,11 +444,14 @@ do done # NLS nuisances. -# Only set LANG and LC_ALL to C if already set. -# These must not be set unconditionally because not all systems understand -# e.g. LANG=C (notably SCO). -if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +# Only set these to C if already set. These must not be set unconditionally +# because not all systems understand e.g. LANG=C (notably SCO). +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +# Non-C LC_CTYPE values break the ctype check. if test "${LANG+set}" = set; then LANG=C; export LANG; fi +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -rf conftest* confdefs.h @@ -508,6 +513,7 @@ ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. @@ -624,6 +630,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:634: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -638,12 +645,13 @@ NONE) esac host=`$ac_config_sub $host_alias` -host_cpu=`echo $host | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'` -host_vendor=`echo $host | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'` -host_os=`echo $host | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'` +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:655: checking target system type" >&5 target_alias=$target case "$target_alias" in @@ -655,12 +663,13 @@ NONE) esac target=`$ac_config_sub $target_alias` -target_cpu=`echo $target | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'` -target_vendor=`echo $target | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'` -target_os=`echo $target | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'` +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:673: checking build system type" >&5 build_alias=$build case "$build_alias" in @@ -672,9 +681,9 @@ NONE) esac build=`$ac_config_sub $build_alias` -build_cpu=`echo $build | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'` -build_vendor=`echo $build | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'` -build_os=`echo $build | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'` +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" && @@ -728,6 +737,7 @@ fi # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:741: 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 @@ -756,6 +766,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:770: 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 @@ -802,7 +813,47 @@ 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:818: 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 $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; 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* + +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:852: 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:857: 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 @@ -811,7 +862,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:815: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:866: \"$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 @@ -819,29 +870,34 @@ fi fi echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + if test $ac_cv_prog_gcc = yes; then GCC=yes - if test "${CFLAGS+set}" != set; then - echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -if eval "test \"`echo '$''{'ac_cv_prog_gcc_g'+set}'`\" = set"; then + 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:881: 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_gcc_g=yes + ac_cv_prog_cc_g=yes else - ac_cv_prog_gcc_g=no + ac_cv_prog_cc_g=no fi rm -f conftest* fi -echo "$ac_t""$ac_cv_prog_gcc_g" 1>&6 - if test $ac_cv_prog_gcc_g = yes; then - CFLAGS="-g -O" - else - CFLAGS="-O" - fi +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 + CFLAGS="-g -O2" + else + CFLAGS="-O2" fi else GCC= @@ -850,6 +906,7 @@ fi echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6 +echo "configure:910: checking for POSIXized ISC" >&5 if test -d /etc/conf/kconfig.d && grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1 then @@ -883,6 +940,7 @@ fi # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. set dummy ${ac_tool_prefix}ar; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:944: 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 @@ -913,6 +971,7 @@ fi # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:975: 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 @@ -943,6 +1002,7 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1006: 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 @@ -984,11 +1044,12 @@ fi # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +echo "configure:1048: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:" for ac_dir in $PATH; do # Account for people who put trailing slashes in PATH elements. case "$ac_dir/" in @@ -1011,7 +1072,7 @@ else ;; esac done - IFS="$ac_save_ifs" + IFS="$ac_save_IFS" fi if test "${ac_cv_path_install+set}" = set; then @@ -1090,6 +1151,7 @@ fi echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 +echo "configure:1155: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -1104,33 +1166,37 @@ else # 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:1114: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1176: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : else echo "$ac_err" >&5 + 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:1129: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1193: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : else echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* CPP=/lib/cpp fi @@ -1147,24 +1213,27 @@ echo "$ac_t""$CPP" 1>&6 for ac_hdr in stddef.h string.h strings.h stdlib.h time.h unistd.h do -ac_safe=`echo "$ac_hdr" | tr './\055' '___'` +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:1219: 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:1162: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1229: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* eval "ac_cv_header_$ac_safe=yes" else echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_header_$ac_safe=no" fi @@ -1172,7 +1241,7 @@ rm -f conftest* fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | tr 'abcdefghijklmnopqrstuvwxyz./\055' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ___'` + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` cat >> confdefs.h <&6 +echo "configure:1259: 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:1199: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1269: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* eval "ac_cv_header_$ac_safe=yes" else echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_header_$ac_safe=no" fi @@ -1209,7 +1281,7 @@ rm -f conftest* fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | tr 'abcdefghijklmnopqrstuvwxyz./\055' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ___'` + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` cat >> confdefs.h <&6 +echo "configure:1296: checking whether time.h and sys/time.h may both be included" >&5 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include #include -int main() { return 0; } -int t() { +int main() { struct tm *tp; ; return 0; } EOF -if { (eval echo configure:1238: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1310: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* 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 "$ac_t""$ac_cv_header_time" 1>&6 @@ -1256,11 +1329,12 @@ fi for ac_func in fcntl getpagesize setitimer sysconf do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:1333: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; }; then +if { (eval echo configure:1361: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_$ac_func=no" fi rm -f conftest* - fi + if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` @@ -1317,11 +1392,12 @@ EOF esac echo $ac_n "checking whether strstr must be declared""... $ac_c" 1>&6 +echo "configure:1396: 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 < @@ -1338,20 +1414,20 @@ else #ifdef HAVE_UNISTD_H #include #endif -int main() { return 0; } -int t() { +int main() { char *(*pfn) = (char *(*)) strstr ; return 0; } EOF -if { (eval echo configure:1347: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1422: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_strstr=no 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 @@ -1364,11 +1440,12 @@ EOF fi echo $ac_n "checking whether malloc must be declared""... $ac_c" 1>&6 +echo "configure:1444: 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 < @@ -1385,20 +1462,20 @@ else #ifdef HAVE_UNISTD_H #include #endif -int main() { return 0; } -int t() { +int main() { char *(*pfn) = (char *(*)) malloc ; return 0; } EOF -if { (eval echo configure:1394: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1470: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_malloc=no 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 echo "$ac_t""$bfd_cv_decl_needed_malloc" 1>&6 @@ -1411,11 +1488,12 @@ EOF fi echo $ac_n "checking whether realloc must be declared""... $ac_c" 1>&6 +echo "configure:1492: checking whether realloc must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_realloc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -1432,20 +1510,20 @@ else #ifdef HAVE_UNISTD_H #include #endif -int main() { return 0; } -int t() { +int main() { char *(*pfn) = (char *(*)) realloc ; return 0; } EOF -if { (eval echo configure:1441: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1518: \"$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 echo "$ac_t""$bfd_cv_decl_needed_realloc" 1>&6 @@ -1458,11 +1536,12 @@ EOF fi echo $ac_n "checking whether free must be declared""... $ac_c" 1>&6 +echo "configure:1540: checking whether free must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_free'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -1479,20 +1558,20 @@ else #ifdef HAVE_UNISTD_H #include #endif -int main() { return 0; } -int t() { +int main() { char *(*pfn) = (char *(*)) free ; return 0; } EOF -if { (eval echo configure:1488: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1566: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_free=no 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 @@ -1505,11 +1584,12 @@ EOF fi echo $ac_n "checking whether getenv must be declared""... $ac_c" 1>&6 +echo "configure:1588: 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 < @@ -1526,20 +1606,20 @@ else #ifdef HAVE_UNISTD_H #include #endif -int main() { return 0; } -int t() { +int main() { char *(*pfn) = (char *(*)) getenv ; return 0; } EOF -if { (eval echo configure:1535: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1614: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_getenv=no 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 @@ -1751,6 +1831,7 @@ EOF rs6000-*-*) COREFILE=rs6000-core.o ;; powerpc-*-aix4*) COREFILE=rs6000-core.o ;; powerpc-*-aix*) COREFILE=rs6000-core.o ;; + powerpc-*-beos*) ;; sparc-*-netbsd*) COREFILE=netbsd-core.o ;; @@ -1800,27 +1881,28 @@ EOF # Define HAVE_SYS_PROCFS_H if the file exists and defines # prstatus_t. echo $ac_n "checking for sys/procfs.h""... $ac_c" 1>&6 +echo "configure:1885: checking for sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_header_sys_procfs_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < -int main() { return 0; } -int t() { +int main() { prstatus_t t; ; return 0; } EOF -if { (eval echo configure:1816: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1897: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_header_sys_procfs_h=yes else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* bfd_cv_header_sys_procfs_h=no fi rm -f conftest* - fi echo "$ac_t""$bfd_cv_header_sys_procfs_h" 1>&6 @@ -1935,9 +2017,7 @@ do bfd_elf32_bigmips_vec) tb="$tb elf32-mips.o elf32.o $elf ecofflink.o" ;; bfd_elf64_bigmips_vec) tb="$tb elf64-mips.o elf64.o elf32-mips.o elf32.o $elf ecofflink.o" target64=true ;; -# start-sanitize-d10v bfd_elf32_d10v_vec) tb="$tb elf32-d10v.o elf32.o $elf" ;; -# end-sanitize-d10v # start-sanitize-d30v bfd_elf32_d30v_vec) tb="$tb elf32-d30v.o elf32.o $elf" ;; # end-sanitize-d30v @@ -1974,6 +2054,7 @@ do target64=true ;; ecoff_big_vec) tb="$tb coff-mips.o ecoff.o ecofflink.o" ;; ecoff_little_vec) tb="$tb coff-mips.o ecoff.o ecofflink.o" ;; + ecoff_biglittle_vec) tb="$tb coff-mips.o ecoff.o ecofflink.o" ;; ecoffalpha_little_vec) tb="$tb coff-alpha.o ecoff.o ecofflink.o" target64=true ;; evax_alpha_vec) tb="$tb evax-alpha.o evax-emh.o evax-egsd.o evax-etir.o evax-misc.o" @@ -2009,6 +2090,7 @@ do m68knetbsd_vec) tb="$tb m68knetbsd.o aout32.o" ;; m68k4knetbsd_vec) tb="$tb m68k4knetbsd.o aout32.o" ;; m68kaux_coff_vec) tb="$tb coff-aux.o coff-m68k.o cofflink.o" ;; + m68ksysvcoff_vec) tb="$tb coff-svm68k.o cofflink.o" ;; m88kbcs_vec) tb="$tb coff-m88k.o" ;; newsos3_vec) tb="$tb newsos3.o aout32.o" ;; nlm32_i386_vec) tb="$tb nlm32-i386.o nlm32.o nlm.o" ;; @@ -2120,40 +2202,55 @@ test -n "${selarchs}" && tdefaults="${tdefaults} -DSELECT_ARCHITECTURES='${selar test -n "${havevecs}" && tdefaults="${tdefaults} ${havevecs}" -# If we cannot run a trivial program, we must be cross compiling. -echo $ac_n "checking whether cross-compiling""... $ac_c" 1>&6 -if eval "test \"`echo '$''{'ac_cv_c_cross'+set}'`\" = set"; then +for ac_hdr in unistd.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:2210: 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 - if test "$cross_compiling" = yes; then - ac_cv_c_cross=yes -else -cat > conftest.$ac_ext < conftest.$ac_ext < EOF -{ (eval echo configure:2137: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } -if test -s conftest && (./conftest; exit) 2>/dev/null; then - ac_cv_c_cross=no +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:2220: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" else - ac_cv_c_cross=yes + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" fi +rm -f conftest* fi -rm -fr conftest* +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 <&6 fi +done -echo "$ac_t""$ac_cv_c_cross" 1>&6 -cross_compiling=$ac_cv_c_cross - -for ac_func in valloc getpagesize +for ac_func in getpagesize do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:2249: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; }; then +if { (eval echo configure:2277: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_$ac_func=no" fi rm -f conftest* - fi + if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` @@ -2200,94 +2298,170 @@ fi done echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -if eval "test \"`echo '$''{'ac_cv_func_mmap'+set}'`\" = set"; then +echo "configure:2302: checking for working mmap" >&5 +if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test "$cross_compiling" = yes; then - ac_cv_func_mmap=no + ac_cv_func_mmap_fixed_mapped=no else -cat > conftest.$ac_ext < conftest.$ac_ext < #include #include +/* This mess was copied from the GNU getpagesize.h. */ #ifndef HAVE_GETPAGESIZE -# include -# ifdef EXEC_PAGESIZE -# define getpagesize() EXEC_PAGESIZE -# else -# ifdef NBPG -# define getpagesize() NBPG * CLSIZE -# ifndef CLSIZE -# define CLSIZE 1 -# endif -# else -# ifdef NBPC -# define getpagesize() NBPC -# else -# define getpagesize() PAGESIZE /* SVR4 */ -# endif -# endif +# ifdef HAVE_UNISTD_H +# include # endif -#endif -#ifndef HAVE_VALLOC -# define valloc malloc -#endif +/* Assume that all systems that can run configure have sys/param.h. */ +# ifndef HAVE_SYS_PARAM_H +# define HAVE_SYS_PARAM_H 1 +# endif + +# ifdef _SC_PAGESIZE +# define getpagesize() sysconf(_SC_PAGESIZE) +# else /* no _SC_PAGESIZE */ +# ifdef HAVE_SYS_PARAM_H +# include +# ifdef EXEC_PAGESIZE +# define getpagesize() EXEC_PAGESIZE +# else /* no EXEC_PAGESIZE */ +# ifdef NBPG +# define getpagesize() NBPG * CLSIZE +# ifndef CLSIZE +# define CLSIZE 1 +# endif /* no CLSIZE */ +# else /* no NBPG */ +# ifdef NBPC +# define getpagesize() NBPC +# else /* no NBPC */ +# ifdef PAGESIZE +# define getpagesize() PAGESIZE +# endif /* PAGESIZE */ +# endif /* no NBPC */ +# endif /* no NBPG */ +# endif /* no EXEC_PAGESIZE */ +# else /* no HAVE_SYS_PARAM_H */ +# define getpagesize() 8192 /* punt totally */ +# endif /* no HAVE_SYS_PARAM_H */ +# endif /* no _SC_PAGESIZE */ + +#endif /* no HAVE_GETPAGESIZE */ #ifdef __cplusplus -extern "C" { void *valloc(unsigned), *malloc(unsigned); } +extern "C" { void *malloc(unsigned); } #else -char *valloc(), *malloc(); +char *malloc(); #endif int main() { - char *buf1, *buf2, *buf3; - int i = getpagesize(), j; - int i2 = i * 2; - int fd; - - buf1 = (char *)valloc(i2); - buf2 = (char *)valloc(i); - buf3 = (char *)malloc(i2); - for (j = 0; j < i2; ++j) - *(buf1 + j) = rand(); - fd = open("conftestmmap", O_CREAT | O_RDWR, 0666); - write(fd, buf1, i2); - mmap(buf2, i, PROT_READ | PROT_WRITE, MAP_FIXED | MAP_PRIVATE, fd, 0); - for (j = 0; j < i; ++j) - if (*(buf1 + j) != *(buf2 + j)) - exit(1); - lseek(fd, (long)i, 0); - read(fd, buf2, i); /* read into mapped memory -- file should not change */ - /* (it does in i386 SVR4.0 - Jim Avera, jima@netcom.com) */ - lseek(fd, (long)0, 0); - read(fd, buf3, i2); - for (j = 0; j < i2; ++j) - if (*(buf1 + j) != *(buf3 + j)) - exit(1); - exit(0); + char *data, *data2, *data3; + int i, pagesize; + int fd; + + pagesize = getpagesize(); + + /* + * First, make a file with some known garbage in it. + */ + data = malloc(pagesize); + if (!data) + exit(1); + for (i = 0; i < pagesize; ++i) + *(data + i) = rand(); + umask(0); + fd = creat("conftestmmap", 0600); + if (fd < 0) + exit(1); + if (write(fd, data, pagesize) != pagesize) + exit(1); + close(fd); + + /* + * Next, try to mmap the file at a fixed address which + * already has something else allocated at it. If we can, + * also make sure that we see the same garbage. + */ + fd = open("conftestmmap", O_RDWR); + if (fd < 0) + exit(1); + data2 = malloc(2 * pagesize); + if (!data2) + exit(1); + data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1); + if (data2 != mmap(data2, pagesize, PROT_READ | PROT_WRITE, + MAP_PRIVATE | MAP_FIXED, fd, 0L)) + exit(1); + for (i = 0; i < pagesize; ++i) + if (*(data + i) != *(data2 + i)) + exit(1); + + /* + * Finally, make sure that changes to the mapped area + * do not percolate back to the file as seen by read(). + * (This is a bug on some variants of i386 svr4.0.) + */ + for (i = 0; i < pagesize; ++i) + *(data2 + i) = *(data2 + i) + 1; + data3 = malloc(pagesize); + if (!data3) + exit(1); + if (read(fd, data3, pagesize) != pagesize) + exit(1); + for (i = 0; i < pagesize; ++i) + if (*(data + i) != *(data3 + i)) + exit(1); + close(fd); + unlink("conftestmmap"); + exit(0); } EOF -{ (eval echo configure:2280: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } -if test -s conftest && (./conftest; exit) 2>/dev/null; then - ac_cv_func_mmap=yes +if { (eval echo configure:2450: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + ac_cv_func_mmap_fixed_mapped=yes else - ac_cv_func_mmap=no -fi + 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 "$ac_t""$ac_cv_func_mmap" 1>&6 -if test $ac_cv_func_mmap = yes; then +fi + +echo "$ac_t""$ac_cv_func_mmap_fixed_mapped" 1>&6 +if test $ac_cv_func_mmap_fixed_mapped = yes; then cat >> confdefs.h <<\EOF #define HAVE_MMAP 1 EOF @@ -2297,11 +2471,12 @@ fi for ac_func in madvise mprotect do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:2475: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; }; then +if { (eval echo configure:2503: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_$ac_func=no" fi rm -f conftest* - fi + if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` @@ -2372,11 +2548,25 @@ cat > confcache <<\EOF # --recheck option to rerun configure. # EOF +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. (set) 2>&1 | - sed -n "s/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=\${\1='\2'}/p" \ - >> confcache + case `(ac_space=' '; set) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache if cmp -s $cache_file confcache; then : else @@ -2431,7 +2621,7 @@ do 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.10" + echo "$CONFIG_STATUS generated by autoconf version 2.12" exit 0 ;; -help | --help | --hel | --he | --h) echo "\$ac_cs_usage"; exit 0 ;; @@ -2520,20 +2710,56 @@ 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 +fi +EOF + cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then - # Support "outfile[:infile]", defaulting infile="outfile.in". + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case "$ac_file" in - *:*) ac_file_in=`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 - # Adjust relative srcdir, etc. for subdirectories. + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. # Remove last slash and all that follows it. Not all systems have dirname. ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` @@ -2561,6 +2787,7 @@ for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then [/$]*) 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." @@ -2569,14 +2796,16 @@ for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then # $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 -" -f conftest.subs $ac_given_srcdir/$ac_file_in > $ac_file +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file fi; done -rm -f conftest.subs +rm -f conftest.s* # These sed commands are passed to sed as "A NAME B NAME C VALUE D", where # NAME is the cpp macro being defined and VALUE is the value it is being given. @@ -2597,11 +2826,17 @@ ac_eB='$%\1#\2define\3' ac_eC=' ' ac_eD='%g' -CONFIG_HEADERS=${CONFIG_HEADERS-"config.h:config.in"} +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 - # Support "outfile[:infile]", defaulting infile="outfile.in". + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case "$ac_file" in - *:*) ac_file_in=`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 @@ -2609,7 +2844,8 @@ for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then echo creating $ac_file rm -f conftest.frag conftest.in conftest.out - cp $ac_given_srcdir/$ac_file_in conftest.in + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + cat $ac_file_inputs > conftest.in EOF @@ -2637,8 +2873,6 @@ EOF # Break up conftest.vals because some shells have a limit on # the size of here documents, and old seds have small limits too. -# Maximum number of lines to put in a single here document. -ac_max_here_lines=12 rm -f conftest.tail while : @@ -2680,7 +2914,11 @@ cat >> $CONFIG_STATUS <<\EOF fi fi; done +EOF +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF case x$CONFIG_HEADERS in xconfig.h:config.in) echo > stamp-h ;; esac exit 0 EOF diff --git a/bfd/configure.in b/bfd/configure.in index 7ee2cd0f698..2b2580868f1 100644 --- a/bfd/configure.in +++ b/bfd/configure.in @@ -293,6 +293,7 @@ changequote([,])dnl rs6000-*-*) COREFILE=rs6000-core.o ;; powerpc-*-aix4*) COREFILE=rs6000-core.o ;; powerpc-*-aix*) COREFILE=rs6000-core.o ;; + powerpc-*-beos*) ;; sparc-*-netbsd*) COREFILE=netbsd-core.o ;; @@ -443,9 +444,7 @@ do bfd_elf32_bigmips_vec) tb="$tb elf32-mips.o elf32.o $elf ecofflink.o" ;; bfd_elf64_bigmips_vec) tb="$tb elf64-mips.o elf64.o elf32-mips.o elf32.o $elf ecofflink.o" target64=true ;; -# start-sanitize-d10v bfd_elf32_d10v_vec) tb="$tb elf32-d10v.o elf32.o $elf" ;; -# end-sanitize-d10v # start-sanitize-d30v bfd_elf32_d30v_vec) tb="$tb elf32-d30v.o elf32.o $elf" ;; # end-sanitize-d30v @@ -482,6 +481,7 @@ do target64=true ;; ecoff_big_vec) tb="$tb coff-mips.o ecoff.o ecofflink.o" ;; ecoff_little_vec) tb="$tb coff-mips.o ecoff.o ecofflink.o" ;; + ecoff_biglittle_vec) tb="$tb coff-mips.o ecoff.o ecofflink.o" ;; ecoffalpha_little_vec) tb="$tb coff-alpha.o ecoff.o ecofflink.o" target64=true ;; evax_alpha_vec) tb="$tb evax-alpha.o evax-emh.o evax-egsd.o evax-etir.o evax-misc.o" @@ -517,6 +517,7 @@ do m68knetbsd_vec) tb="$tb m68knetbsd.o aout32.o" ;; m68k4knetbsd_vec) tb="$tb m68k4knetbsd.o aout32.o" ;; m68kaux_coff_vec) tb="$tb coff-aux.o coff-m68k.o cofflink.o" ;; + m68ksysvcoff_vec) tb="$tb coff-svm68k.o cofflink.o" ;; m88kbcs_vec) tb="$tb coff-m88k.o" ;; newsos3_vec) tb="$tb newsos3.o aout32.o" ;; nlm32_i386_vec) tb="$tb nlm32-i386.o nlm32.o nlm.o" ;; diff --git a/bfd/targets.c b/bfd/targets.c index c7bb0cc2799..a43f9e215a0 100644 --- a/bfd/targets.c +++ b/bfd/targets.c @@ -560,6 +560,7 @@ 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 m68k4knetbsd_vec; extern const bfd_target m88kbcs_vec; extern const bfd_target m88kmach3_vec; @@ -760,6 +761,7 @@ const bfd_target * const bfd_target_vector[] = { &m68klynx_aout_vec, &m68klynx_coff_vec, &m68knetbsd_vec, + &m68ksysvcoff_vec, &m88kbcs_vec, &m88kmach3_vec, &newsos3_vec, @@ -849,7 +851,7 @@ const bfd_target * const bfd_target_vector[] = { /* bfd_default_vector[0] contains either the address of the default vector, if there is one, or zero if there isn't. */ -const bfd_target * const bfd_default_vector[] = { +const bfd_target *bfd_default_vector[] = { #ifdef DEFAULT_VECTOR &DEFAULT_VECTOR, #endif @@ -860,7 +862,7 @@ const bfd_target * const bfd_default_vector[] = { names of the matching targets in an array. This variable is the maximum number of entries that the array could possibly need. */ const size_t _bfd_target_vector_entries = sizeof(bfd_target_vector)/sizeof(*bfd_target_vector); - + /* This array maps configuration triplets onto BFD vectors. */ struct targmatch @@ -882,6 +884,101 @@ static const struct targmatch bfd_target_match[] = { { NULL, NULL } }; +static const bfd_target *find_target PARAMS ((const char *)); + +/* Find a target vector, given a name or configuration triplet. */ + +static const bfd_target * +find_target (name) + const char *name; +{ + const bfd_target * const *target; + const struct targmatch *match; + + for (target = &bfd_target_vector[0]; *target != NULL; target++) + if (strcmp (name, (*target)->name) == 0) + return *target; + + /* If we couldn't match on the exact name, try matching on the + configuration triplet. FIXME: We should run the triplet through + config.sub first, but that is hard. */ + for (match = &bfd_target_match[0]; match->triplet != NULL; match++) + { + if (fnmatch (match->triplet, name, 0) == 0) + { + while (match->vector == NULL) + ++match; + if (match->vector != UNSUPPORTED_TARGET) + return match->vector; + break; + } + } + + bfd_set_error (bfd_error_invalid_target); + return NULL; +} + +/* +FUNCTION + bfd_set_default_target + +SYNOPSIS + boolean bfd_set_default_target (const char *name); + +DESCRIPTION + Set the default target vector to use when recognizing a BFD. + This takes the name of the target, which may be a BFD target + name or a configuration triplet. +*/ + +boolean +bfd_set_default_target (name) + const char *name; +{ + const bfd_target *old_default; + const bfd_target *target; + + old_default = bfd_default_vector[0]; + if (old_default != NULL) + { + register const struct targmatch *match; + + /* Try to save some strcmp and fnmatch calls by seeing if we + already have the default. */ + + if (strcmp (name, old_default->name) == 0) + return true; + + for (match = &bfd_target_match[0]; match->triplet != NULL; match++) + { + if (match->vector == old_default) + { + const struct targmatch *back; + + back = match; + do + { + if (fnmatch (back->triplet, name, 0) == 0) + return true; + + if (back == &bfd_target_match[0]) + break; + + --back; + } + while (back->vector == NULL); + } + } + } + + target = find_target (name); + if (target == NULL) + return false; + + bfd_default_vector[0] = target; + return true; +} + /* FUNCTION bfd_find_target @@ -906,9 +1003,8 @@ bfd_find_target (target_name, abfd) const char *target_name; bfd *abfd; { - const bfd_target * const *target; const char *targname; - const struct targmatch *match; + const bfd_target *target; if (target_name != NULL) targname = target_name; @@ -919,45 +1015,23 @@ bfd_find_target (target_name, abfd) if (targname == NULL || strcmp (targname, "default") == 0) { abfd->target_defaulted = true; - abfd->xvec = bfd_target_vector[0]; - return bfd_target_vector[0]; + if (bfd_default_vector[0] != NULL) + abfd->xvec = bfd_default_vector[0]; + else + abfd->xvec = bfd_target_vector[0]; + return abfd->xvec; } abfd->target_defaulted = false; - for (target = &bfd_target_vector[0]; *target != NULL; target++) - { - if (strcmp (targname, (*target)->name) == 0) - { - abfd->xvec = *target; - return *target; - } - } - - /* If we couldn't match on the exact name, try matching on the - configuration triplet. FIXME: We should run the triplet through - config.sub first, but that is hard. */ - for (match = &bfd_target_match[0]; match->triplet != NULL; match++) - { - if (fnmatch (match->triplet, targname, 0) == 0) - { - while (match->vector == NULL) - ++match; - if (match->vector != UNSUPPORTED_TARGET) - { - abfd->xvec = match->vector; - return match->vector; - } - break; - } - } - - bfd_set_error (bfd_error_invalid_target); + target = find_target (targname); + if (target == NULL) + return NULL; - return NULL; + abfd->xvec = target; + return target; } - /* FUNCTION bfd_target_list -- 2.30.2