From fd8d7c31c0b9b4fc9fa7ca9e6d38e4843cf2ff65 Mon Sep 17 00:00:00 2001 From: Martin Hunt Date: Wed, 19 Feb 1997 01:29:29 +0000 Subject: [PATCH] Tue Feb 18 17:22:59 1997 Martin M. Hunt * Makefile.in, archures.c, config.bfd, configure.in, elf.c, reloc.c, targets.c: New target, elf-*-D30V. * bfd-in2.h, configure, libbfd.h: Rebuilt. * cpu-d30v.c, elf32-d30v.c: New files. --- bfd/.Sanitize | 36 ++++ bfd/ChangeLog | 11 + bfd/Makefile.in | 14 +- bfd/archures.c | 17 +- bfd/bfd-in2.h | 34 ++++ bfd/config.bfd | 12 +- bfd/configure | 606 +++++++++++++++++-------------------------------------- bfd/configure.in | 5 +- bfd/cpu-d30v.c | 39 ++++ bfd/elf.c | 7 +- bfd/elf32-d30v.c | 348 ++++++++++++++++++++++++++++++++ bfd/libbfd.h | 11 + bfd/reloc.c | 40 ++++ bfd/targets.c | 87 ++++++-- 14 files changed, 830 insertions(+), 437 deletions(-) create mode 100644 bfd/cpu-d30v.c create mode 100644 bfd/elf32-d30v.c diff --git a/bfd/.Sanitize b/bfd/.Sanitize index 0324b84..619acca 100644 --- a/bfd/.Sanitize +++ b/bfd/.Sanitize @@ -31,6 +31,14 @@ else lose_these_too="${d10v_files} ${lose_these_too}" fi +d30v_files="cpu-d30v.c elf32-d30v.c" + +if ( echo $* | grep keep\-d30v > /dev/null ) ; then + keep_these_too="${d30v_files} ${keep_these_too}" +else + lose_these_too="${d30v_files} ${lose_these_too}" +fi + m32r_files="cpu-m32r.c elf32-m32r.c" if ( echo $* | grep keep\-m32r > /dev/null ) ; then @@ -355,6 +363,34 @@ else done fi +d30v_files="ChangeLog ChangeLog.2 Makefile.in archures.c reloc.c targets.c config.bfd configure.in configure bfd-in2.h elf.c libbfd.h" +if ( echo $* | grep keep\-d30v > /dev/null ) ; then + for i in $d30v_files ; do + if test ! -d $i && (grep sanitize-d30v $i > /dev/null) ; then + if [ -n "${verbose}" ] ; then + echo Keeping d30v stuff in $i + fi + fi + done +else + for i in $d30v_files ; do + if test ! -d $i && (grep sanitize-d30v $i > /dev/null) ; then + if [ -n "${verbose}" ] ; then + echo Removing traces of \"d30v\" from $i... + fi + cp $i new + sed '/start\-sanitize\-d30v/,/end-\sanitize\-d30v/d' < $i > new + if [ -n "${safe}" -a ! -f .Recover/$i ] ; then + if [ -n "${verbose}" ] ; then + echo Caching $i in .Recover... + fi + mv $i .Recover + fi + mv new $i + fi + done +fi + m32r_files="ChangeLog Makefile.in config.bfd configure.in configure elf.c archures.c reloc.c targets.c bfd-in2.h libbfd.h" if ( echo $* | grep keep\-m32r > /dev/null ) ; then for i in $m32r_files ; do diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 22fc5df..d8aec39 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,14 @@ +start-sanitize-d30v +Tue Feb 18 17:22:59 1997 Martin M. Hunt + + * Makefile.in, archures.c, config.bfd, configure.in, elf.c, + reloc.c, targets.c: New target, elf-*-D30V. + + * bfd-in2.h, configure, libbfd.h: Rebuilt. + + * cpu-d30v.c, elf32-d30v.c: New files. + +end-sanitize-d30v Tue Feb 18 15:31:48 1997 Fred Fish * reloc.c (struct reloc_howto_struct): Fix typo in comment. diff --git a/bfd/Makefile.in b/bfd/Makefile.in index 2f2f75b..ada0662 100644 --- a/bfd/Makefile.in +++ b/bfd/Makefile.in @@ -119,6 +119,9 @@ ALL_MACHINES = \ $(start-sanitize-d10v) \ cpu-d10v.o \ $(end-sanitize-d10v) \ + $(start-sanitize-d30v) \ + cpu-d30v.o \ + $(end-sanitize-d30v) \ cpu-h8300.o \ cpu-h8500.o \ cpu-hppa.o \ @@ -220,6 +223,9 @@ BFD32_BACKENDS = \ $(start-sanitize-d10v) \ elf32-d10v.o \ $(end-sanitize-d10v) \ + $(start-sanitize-d30v) \ + elf32-d30v.o \ + $(end-sanitize-d30v) \ elf32-gen.o \ elf32-hppa.o \ elf32-i386.o \ @@ -857,6 +863,12 @@ elf32-d10v.o: elf32-d10v.c elf-bfd.h $(INCDIR)/elf/common.h \ elf32-target.h end-sanitize-d10v: +start-sanitize-d30v: +elf32-d30v.o: elf32-d30v.c elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ + elf32-target.h +end-sanitize-d30v: + start-sanitize-m32r: elf32-m32r.o: elf32-m32r.c elf-bfd.h $(INCDIR)/elf/common.h \ $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \ @@ -873,7 +885,7 @@ end-sanitize-v850: start-sanitize-tic80: cpu-tic80.o: cpu-tic80.c coff-tic80.o: coff-tic80.c $(INCDIR)/bfdlink.h elf-bfd.h \ - $(INCDIR)/coff/internal.h + $(INCDIR)/coff/internal.h coffcode.h end-sanitize-tic80: $(OFILES): stamp-picdir diff --git a/bfd/archures.c b/bfd/archures.c index 5090291..b8388f4 100644 --- a/bfd/archures.c +++ b/bfd/archures.c @@ -1,5 +1,5 @@ /* BFD library support routines for architectures. - Copyright (C) 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. + Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. Hacked by John Gilmore and Steve Chamberlain of Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -124,6 +124,9 @@ DESCRIPTION . {* start-sanitize-d10v *} . bfd_arch_d10v, {* Mitsubishi D10V *} . {* end-sanitize-d10v *} +. {* start-sanitize-d30v *} +. bfd_arch_d30v, {* Mitsubishi D30V *} +. {* end-sanitize-d30v *} . bfd_arch_z8k, {* Zilog Z8000 *} .#define bfd_mach_z8001 1 .#define bfd_mach_z8002 2 @@ -133,6 +136,9 @@ DESCRIPTION . bfd_arch_arm, {* Advanced Risc Machines ARM *} . bfd_arch_ns32k, {* National Semiconductors ns32000 *} . bfd_arch_w65, {* WDC 65816 *} +. {* start-sanitize-tic80 *} +. bfd_arch_tic80, {* TI TMS320c80 (MVP) *} +. {* end-sanitize-tic80 *} . {* start-sanitize-v850 *} . bfd_arch_v850, {* NEC V850 *} . {* end-sanitize-v850 *} @@ -195,6 +201,9 @@ extern const bfd_arch_info_type bfd_arm_arch; /* start-sanitize-d10v */ extern const bfd_arch_info_type bfd_d10v_arch; /* end-sanitize-d10v */ +/* start-sanitize-d30v */ +extern const bfd_arch_info_type bfd_d30v_arch; +/* end-sanitize-d30v */ extern const bfd_arch_info_type bfd_h8300_arch; extern const bfd_arch_info_type bfd_h8500_arch; extern const bfd_arch_info_type bfd_hppa_arch; @@ -239,6 +248,9 @@ static const bfd_arch_info_type * const bfd_archures_list[] = /* start-sanitize-d10v */ &bfd_d10v_arch, /* end-sanitize-d10v */ +/* start-sanitize-d30v */ + &bfd_d30v_arch, +/* end-sanitize-d30v */ &bfd_h8300_arch, &bfd_h8500_arch, &bfd_hppa_arch, @@ -257,6 +269,9 @@ static const bfd_arch_info_type * const bfd_archures_list[] = &bfd_rs6000_arch, &bfd_sh_arch, &bfd_sparc_arch, +/* start-sanitize-tic80 */ + &bfd_tic80_arch, +/* end-sanitize-tic80 */ &bfd_vax_arch, &bfd_we32k_arch, &bfd_z8k_arch, diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index 3aa5344..d46d5ea 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -1213,6 +1213,9 @@ enum bfd_architecture /* start-sanitize-d10v */ bfd_arch_d10v, /* Mitsubishi D10V */ /* end-sanitize-d10v */ + /* start-sanitize-d30v */ + bfd_arch_d30v, /* Mitsubishi D30V */ + /* end-sanitize-d30v */ bfd_arch_z8k, /* Zilog Z8000 */ #define bfd_mach_z8001 1 #define bfd_mach_z8002 2 @@ -1861,6 +1864,37 @@ assumed to be 0. */ BFD_RELOC_D10V_18_PCREL, /* end-sanitize-d10v */ +/* start-sanitize-d30v */ + +/* Mitsubishi D30V relocs. +This is a 6-bit absolute reloc. */ + BFD_RELOC_D30V_6, + +/* Mitsubishi D30V relocs. +This is a 12-bit absolute reloc with the +right 3 bitsassumed to be 0. */ + BFD_RELOC_D30V_15, + +/* Mitsubishi D30V relocs. +This is a 12-bit pc-relative reloc with +the right 3 bits assumed to be 0. */ + BFD_RELOC_D30V_15_PCREL, + +/* This is an 18-bit absolute reloc with +the right 3 bits assumed to be 0. */ + BFD_RELOC_D30V_21, + +/* This is an 18-bit pc-relative reloc with +the right 3 bits assumed to be 0. */ + BFD_RELOC_D30V_21_PCREL, + +/* This is a 32-bit absolute reloc. */ + BFD_RELOC_D30V_32, + +/* This is a 32-bit pc-relative reloc. */ + BFD_RELOC_D30V_32_PCREL, +/* end-sanitize-d30v */ + /* start-sanitize-m32r */ /* Mitsubishi M32R relocs. diff --git a/bfd/config.bfd b/bfd/config.bfd index 222e5ed..77f0d9b 100755 --- a/bfd/config.bfd +++ b/bfd/config.bfd @@ -114,6 +114,12 @@ case "${targ}" in ;; # end-sanitize-d10v +# start-sanitize-d30v + d30v-*-*) + targ_defvec=bfd_elf32_d30v_vec + ;; +# end-sanitize-d30v + h8300*-*-*) targ_defvec=h8300coff_vec targ_underscore=yes @@ -401,6 +407,10 @@ case "${targ}" in targ_defvec=bfd_elf32_bigmips_vec targ_selvecs="bfd_elf32_littlemips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec" ;; + mips*-*-none) + targ_defvec=bfd_elf32_bigmips_vec + targ_selvecs="bfd_elf32_littlemips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec" + ;; mips*el*-*-linux*) targ_defvec=bfd_elf32_littlemips_vec targ_selvecs="bfd_elf32_bigmips_vec ecoff_little_vec ecoff_big_vec" @@ -518,7 +528,7 @@ case "${targ}" in #endif # start-sanitize-tic80 - tic80*-*-coff*) + tic80*-*-*) targ_defvec=tic80coff_vec ;; diff --git a/bfd/configure b/bfd/configure index 8341faf..9183796 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.12 +# Generated automatically using autoconf version 2.10 # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. # # This configure script is free software; the Free Software Foundation @@ -59,8 +59,6 @@ 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 @@ -342,7 +340,7 @@ EOF verbose=yes ;; -version | --version | --versio | --versi | --vers) - echo "configure generated by autoconf version 2.12" + echo "configure generated by autoconf version 2.10" exit 0 ;; -with-* | --with-*) @@ -444,14 +442,11 @@ do 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 +# Only set LANG and LC_ALL to C if already set. +# These must not be set unconditionally because not all systems understand +# e.g. LANG=C (notably SCO). if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi -if test "${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 +if test "${LANG+set}" = set; then LANG=C; export LANG; fi # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -rf conftest* confdefs.h @@ -513,7 +508,6 @@ 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. @@ -630,7 +624,6 @@ 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 @@ -645,13 +638,12 @@ 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 @@ -663,13 +655,12 @@ 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 @@ -681,9 +672,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" && @@ -737,7 +728,6 @@ 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 @@ -766,7 +756,6 @@ 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 @@ -813,47 +802,7 @@ 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 @@ -862,7 +811,7 @@ else yes; #endif EOF -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 +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 ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -870,34 +819,29 @@ fi fi echo "$ac_t""$ac_cv_prog_gcc" 1>&6 - if test $ac_cv_prog_gcc = yes; then GCC=yes - 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 + if test "${CFLAGS+set}" != set; then + echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_prog_gcc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else echo 'void f(){}' > conftest.c if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then - ac_cv_prog_cc_g=yes + ac_cv_prog_gcc_g=yes else - ac_cv_prog_cc_g=no + ac_cv_prog_gcc_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 - CFLAGS="-g -O2" - else - CFLAGS="-O2" +echo "$ac_t""$ac_cv_prog_gcc_g" 1>&6 + if test $ac_cv_prog_gcc_g = yes; then + CFLAGS="-g -O" + else + CFLAGS="-O" + fi fi else GCC= @@ -906,7 +850,6 @@ 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 @@ -940,7 +883,6 @@ 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 @@ -971,7 +913,6 @@ fi # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -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 @@ -1002,7 +943,6 @@ 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 @@ -1044,12 +984,11 @@ 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 @@ -1072,7 +1011,7 @@ else ;; esac done - IFS="$ac_save_IFS" + IFS="$ac_save_ifs" fi if test "${ac_cv_path_install+set}" = set; then @@ -1151,7 +1090,6 @@ 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= @@ -1166,37 +1104,33 @@ 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:1176: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1114: \"$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:1193: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1129: \"$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 @@ -1213,27 +1147,24 @@ 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" | sed 'y%./+-%__p_%'` +ac_safe=`echo "$ac_hdr" | tr './\055' '___'` 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:1229: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1162: \"$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 @@ -1241,7 +1172,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 | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + ac_tr_hdr=HAVE_`echo $ac_hdr | tr 'abcdefghijklmnopqrstuvwxyz./\055' '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:1269: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1199: \"$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 @@ -1281,7 +1209,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 | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + ac_tr_hdr=HAVE_`echo $ac_hdr | tr 'abcdefghijklmnopqrstuvwxyz./\055' '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() { +int main() { return 0; } +int t() { struct tm *tp; ; return 0; } EOF -if { (eval echo configure:1310: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1238: \"$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 @@ -1329,12 +1256,11 @@ 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; } && test -s conftest; then +if { (eval echo configure:1288: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; 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 +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'` @@ -1392,12 +1317,11 @@ 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 < @@ -1414,20 +1338,20 @@ else #ifdef HAVE_UNISTD_H #include #endif -int main() { +int main() { return 0; } +int t() { char *(*pfn) = (char *(*)) strstr ; return 0; } EOF -if { (eval echo configure:1422: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1347: \"$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 @@ -1440,12 +1364,11 @@ 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 < @@ -1462,20 +1385,20 @@ else #ifdef HAVE_UNISTD_H #include #endif -int main() { +int main() { return 0; } +int t() { char *(*pfn) = (char *(*)) malloc ; return 0; } EOF -if { (eval echo configure:1470: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1394: \"$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 @@ -1488,12 +1411,11 @@ 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 < @@ -1510,20 +1432,20 @@ else #ifdef HAVE_UNISTD_H #include #endif -int main() { +int main() { return 0; } +int t() { char *(*pfn) = (char *(*)) realloc ; return 0; } EOF -if { (eval echo configure:1518: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1441: \"$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 @@ -1536,12 +1458,11 @@ 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 < @@ -1558,20 +1479,20 @@ else #ifdef HAVE_UNISTD_H #include #endif -int main() { +int main() { return 0; } +int t() { char *(*pfn) = (char *(*)) free ; return 0; } EOF -if { (eval echo configure:1566: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1488: \"$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 @@ -1584,12 +1505,11 @@ 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 < @@ -1606,20 +1526,20 @@ else #ifdef HAVE_UNISTD_H #include #endif -int main() { +int main() { return 0; } +int t() { char *(*pfn) = (char *(*)) getenv ; return 0; } EOF -if { (eval echo configure:1614: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1535: \"$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 @@ -1880,28 +1800,27 @@ 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:1884: 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() { +int main() { return 0; } +int t() { prstatus_t t; ; return 0; } EOF -if { (eval echo configure:1896: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1816: \"$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 @@ -2019,6 +1938,9 @@ do # 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 bfd_elf32_hppa_vec) tb="$tb elf32-hppa.o elf32.o $elf" ;; bfd_elf32_i386_vec) tb="$tb elf32-i386.o elf32.o $elf" ;; bfd_elf32_i860_vec) tb="$tb elf32-i860.o elf32.o $elf" ;; @@ -2198,55 +2120,40 @@ test -n "${selarchs}" && tdefaults="${tdefaults} -DSELECT_ARCHITECTURES='${selar test -n "${havevecs}" && tdefaults="${tdefaults} ${havevecs}" -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:2206: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then +# If we cannot run a trivial program, we must be cross compiling. +echo $ac_n "checking whether cross-compiling""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_c_cross'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - cat > conftest.$ac_ext < conftest.$ac_ext < +main(){return(0);} EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2216: \"$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" +{ (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 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" + ac_cv_c_cross=yes 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 <&6 +rm -fr conftest* fi -done -for ac_func in getpagesize +echo "$ac_t""$ac_cv_c_cross" 1>&6 +cross_compiling=$ac_cv_c_cross + +for ac_func in valloc getpagesize do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2245: 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; } && test -s conftest; then +if { (eval echo configure:2181: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; 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 +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'` @@ -2294,170 +2200,94 @@ fi done echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:2298: checking for working mmap" >&5 -if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then +if eval "test \"`echo '$''{'ac_cv_func_mmap'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test "$cross_compiling" = yes; then - ac_cv_func_mmap_fixed_mapped=no + ac_cv_func_mmap=no else - cat > conftest.$ac_ext < conftest.$ac_ext < #include #include -/* This mess was copied from the GNU getpagesize.h. */ #ifndef HAVE_GETPAGESIZE -# ifdef HAVE_UNISTD_H -# include -# endif - -/* Assume that all systems that can run configure have sys/param.h. */ -# ifndef HAVE_SYS_PARAM_H -# define HAVE_SYS_PARAM_H 1 +# include +# ifdef EXEC_PAGESIZE +# define getpagesize() EXEC_PAGESIZE +# else +# ifdef NBPG +# define getpagesize() NBPG * CLSIZE +# ifndef CLSIZE +# define CLSIZE 1 +# endif +# else +# ifdef NBPC +# define getpagesize() NBPC +# else +# define getpagesize() PAGESIZE /* SVR4 */ +# endif +# endif # endif +#endif -# 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 */ +#ifndef HAVE_VALLOC +# define valloc malloc +#endif #ifdef __cplusplus -extern "C" { void *malloc(unsigned); } +extern "C" { void *valloc(unsigned), *malloc(unsigned); } #else -char *malloc(); +char *valloc(), *malloc(); #endif int main() { - char *data, *data2, *data3; - int i, pagesize; - int fd; - - pagesize = getpagesize(); - - /* - * First, make a file with some known garbage in it. - */ - data = malloc(pagesize); - if (!data) - exit(1); - for (i = 0; i < pagesize; ++i) - *(data + i) = rand(); - umask(0); - fd = creat("conftestmmap", 0600); - if (fd < 0) - exit(1); - if (write(fd, data, pagesize) != pagesize) - exit(1); - close(fd); - - /* - * Next, try to mmap the file at a fixed address which - * already has something else allocated at it. If we can, - * also make sure that we see the same garbage. - */ - fd = open("conftestmmap", O_RDWR); - if (fd < 0) - exit(1); - data2 = malloc(2 * pagesize); - if (!data2) - exit(1); - data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1); - if (data2 != mmap(data2, pagesize, PROT_READ | PROT_WRITE, - MAP_PRIVATE | MAP_FIXED, fd, 0L)) - exit(1); - for (i = 0; i < pagesize; ++i) - if (*(data + i) != *(data2 + i)) - exit(1); - - /* - * Finally, make sure that changes to the mapped area - * do not percolate back to the file as seen by read(). - * (This is a bug on some variants of i386 svr4.0.) - */ - for (i = 0; i < pagesize; ++i) - *(data2 + i) = *(data2 + i) + 1; - data3 = malloc(pagesize); - if (!data3) - exit(1); - if (read(fd, data3, pagesize) != pagesize) - exit(1); - for (i = 0; i < pagesize; ++i) - if (*(data + i) != *(data3 + i)) - exit(1); - close(fd); - unlink("conftestmmap"); - exit(0); + char *buf1, *buf2, *buf3; + int i = getpagesize(), j; + int i2 = i * 2; + int fd; + + buf1 = (char *)valloc(i2); + buf2 = (char *)valloc(i); + buf3 = (char *)malloc(i2); + for (j = 0; j < i2; ++j) + *(buf1 + j) = rand(); + fd = open("conftestmmap", O_CREAT | O_RDWR, 0666); + write(fd, buf1, i2); + mmap(buf2, i, PROT_READ | PROT_WRITE, MAP_FIXED | MAP_PRIVATE, fd, 0); + for (j = 0; j < i; ++j) + if (*(buf1 + j) != *(buf2 + j)) + exit(1); + lseek(fd, (long)i, 0); + read(fd, buf2, i); /* read into mapped memory -- file should not change */ + /* (it does in i386 SVR4.0 - Jim Avera, jima@netcom.com) */ + lseek(fd, (long)0, 0); + read(fd, buf3, i2); + for (j = 0; j < i2; ++j) + if (*(buf1 + j) != *(buf3 + j)) + exit(1); + exit(0); } EOF -if { (eval echo configure:2446: \"$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 +{ (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 else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_func_mmap_fixed_mapped=no + ac_cv_func_mmap=no fi -rm -fr conftest* fi - +rm -fr conftest* fi -echo "$ac_t""$ac_cv_func_mmap_fixed_mapped" 1>&6 -if test $ac_cv_func_mmap_fixed_mapped = yes; then +echo "$ac_t""$ac_cv_func_mmap" 1>&6 +if test $ac_cv_func_mmap = yes; then cat >> confdefs.h <<\EOF #define HAVE_MMAP 1 EOF @@ -2467,12 +2297,11 @@ fi for ac_func in madvise mprotect do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2471: 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; } && test -s conftest; then +if { (eval echo configure:2329: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; 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 +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'` @@ -2519,7 +2347,7 @@ else fi done -case ${want_mmap}+${ac_cv_func_mmap} in +case ${want_mmap}+${ac_cv_func_mmap_fixed_mapped} in true+yes ) cat >> confdefs.h <<\EOF #define USE_MMAP 1 EOF @@ -2544,25 +2372,11 @@ 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 | - 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 + sed -n "s/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=\${\1='\2'}/p" \ + >> confcache if cmp -s $cache_file confcache; then : else @@ -2617,7 +2431,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.12" + echo "$CONFIG_STATUS generated by autoconf version 2.10" exit 0 ;; -help | --help | --hel | --he | --h) echo "\$ac_cs_usage"; exit 0 ;; @@ -2706,56 +2520,20 @@ 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[:infile...]]", defaulting infile="outfile.in". + # Support "outfile[: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 a relative srcdir, top_srcdir, and INSTALL for subdirectories. + # Adjust relative srcdir, etc. for subdirectories. # Remove last slash and all that follows it. Not all systems have dirname. ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` @@ -2783,7 +2561,6 @@ 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." @@ -2792,16 +2569,14 @@ 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 -" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file +" -f conftest.subs $ac_given_srcdir/$ac_file_in > $ac_file fi; done -rm -f conftest.s* +rm -f conftest.subs # These sed commands are passed to sed as "A NAME B NAME C VALUE D", where # NAME is the cpp macro being defined and VALUE is the value it is being given. @@ -2822,17 +2597,11 @@ ac_eB='$%\1#\2define\3' ac_eC=' ' ac_eD='%g' -if test "${CONFIG_HEADERS+set}" != set; then -EOF -cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF -fi +CONFIG_HEADERS=${CONFIG_HEADERS-"config.h:config.in"} for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + # Support "outfile[: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 @@ -2840,8 +2609,7 @@ 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 - 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 + cp $ac_given_srcdir/$ac_file_in conftest.in EOF @@ -2869,6 +2637,8 @@ 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 : @@ -2910,11 +2680,7 @@ 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 d643299..7ee2cd0 100644 --- a/bfd/configure.in +++ b/bfd/configure.in @@ -446,6 +446,9 @@ do # 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 bfd_elf32_hppa_vec) tb="$tb elf32-hppa.o elf32.o $elf" ;; bfd_elf32_i386_vec) tb="$tb elf32-i386.o elf32.o $elf" ;; bfd_elf32_i860_vec) tb="$tb elf32-i860.o elf32.o $elf" ;; @@ -628,7 +631,7 @@ AC_SUBST(tdefaults) dnl AC_CHECK_HEADERS(sys/mman.h) AC_FUNC_MMAP AC_CHECK_FUNCS(madvise mprotect) -case ${want_mmap}+${ac_cv_func_mmap} in +case ${want_mmap}+${ac_cv_func_mmap_fixed_mapped} in true+yes ) AC_DEFINE(USE_MMAP) ;; esac diff --git a/bfd/cpu-d30v.c b/bfd/cpu-d30v.c new file mode 100644 index 0000000..6eadfee --- /dev/null +++ b/bfd/cpu-d30v.c @@ -0,0 +1,39 @@ +/* BFD support for the Mitsubishi D30V processor + Copyright 1997 Free Software Foundation, Inc. + Contributed by Martin Hunt (hunt@cygnus.com). + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" + +const bfd_arch_info_type bfd_d30v_arch = +{ + 32, /* bits in a word */ + 32, /* bits in an address */ + 8, /* bits in a byte */ + bfd_arch_d30v, + 0, + "d30v", + "d30v", + 4, /* section alignment power */ + true, + bfd_default_compatible, + bfd_default_scan, + 0, +}; diff --git a/bfd/elf.c b/bfd/elf.c index 3015461..fd97456 100644 --- a/bfd/elf.c +++ b/bfd/elf.c @@ -1,5 +1,5 @@ /* ELF executable support for BFD. - Copyright 1993, 1994, 1995, 1996 Free Software Foundation, Inc. + Copyright 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -2518,6 +2518,11 @@ prep_headers (abfd) i_ehdrp->e_machine = EM_CYGNUS_D10V; break; /* end-sanitize-d10v */ +/* start-sanitize-d30v */ + case bfd_arch_d30v: + i_ehdrp->e_machine = EM_CYGNUS_D30V; + break; +/* end-sanitize-d30v */ /* start-sanitize-v850 */ case bfd_arch_v850: i_ehdrp->e_machine = EM_CYGNUS_V850; diff --git a/bfd/elf32-d30v.c b/bfd/elf32-d30v.c new file mode 100644 index 0000000..bd13259 --- /dev/null +++ b/bfd/elf32-d30v.c @@ -0,0 +1,348 @@ +/* D30V-specific support for 32-bit ELF + Copyright (C) 1997 Free Software Foundation, Inc. + Contributed by Martin Hunt (hunt@cygnus.com). + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#include "bfd.h" +#include "sysdep.h" +#include "libbfd.h" +#include "elf-bfd.h" + +static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup + PARAMS ((bfd *abfd, bfd_reloc_code_real_type code)); +static void d30v_info_to_howto_rel + PARAMS ((bfd *, arelent *, Elf32_Internal_Rel *)); +static bfd_reloc_status_type bfd_elf_d30v_reloc PARAMS (( + bfd *abfd, + arelent *reloc_entry, + asymbol *symbol, + PTR data, + asection *input_section, + bfd *output_bfd, + char **error_message)); + +/* Use REL instead of RELA to save space */ +#define USE_REL + +enum reloc_type +{ + R_D30V_NONE = 0, + R_D30V_6, + R_D30V_15, + R_D30V_15_PCREL, + R_D30V_21, + R_D30V_21_PCREL, + R_D30V_32, + R_D30V_32_PCREL, + R_D30V_32_NORMAL, + R_D30V_max +}; + +static reloc_howto_type elf_d30v_howto_table[] = +{ + /* This reloc does nothing. */ + HOWTO (R_D30V_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_D30V_NONE", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + false), /* pcrel_offset */ + + /* A 6 bit absolute relocation */ + HOWTO (R_D30V_6, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 6, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_D30V_6", /* name */ + false, /* partial_inplace */ + 0x3f, /* src_mask */ + 0x3f, /* dst_mask */ + false), /* pcrel_offset */ + + /* An absolute 15 bit relocation, right shifted by 3 */ + HOWTO (R_D30V_15, /* type */ + 3, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 15, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_D30V_15", /* name */ + false, /* partial_inplace */ + 0xfff, /* src_mask */ + 0xfff, /* dst_mask */ + false), /* pcrel_offset */ + + /* A relative 15 bit relocation, right shifted by 3 */ + HOWTO (R_D30V_15_PCREL, /* type */ + 3, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 15, /* bitsize */ + true, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_D30V_15_PCREL", /* name */ + false, /* partial_inplace */ + 0xfff, /* src_mask */ + 0xfff, /* dst_mask */ + true), /* pcrel_offset */ + + /* An absolute 21 bit relocation, right shifted by 3 */ + HOWTO (R_D30V_21_PCREL, /* type */ + 3, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 21, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_D30V_21", /* name */ + false, /* partial_inplace */ + 0x3ffff, /* src_mask */ + 0x3ffff, /* dst_mask */ + false), /* pcrel_offset */ + + /* A relative 21 bit relocation, right shifted by 3 */ + HOWTO (R_D30V_21_PCREL, /* type */ + 3, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 21, /* bitsize */ + true, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_D30V_21_PCREL", /* name */ + false, /* partial_inplace */ + 0x3ffff, /* src_mask */ + 0x3ffff, /* dst_mask */ + true), /* pcrel_offset */ + + /* A D30V 32 bit absolute relocation */ + HOWTO (R_D30V_32, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_d30v_reloc, /* special_function */ + "R_D30V_32", /* name */ + false, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + false), /* pcrel_offset */ + + /* A relative 32 bit relocation */ + HOWTO (R_D30V_32_PCREL, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + true, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_d30v_reloc, /* special_function */ + "R_D30V_32_PCREL", /* name */ + false, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + true), /* pcrel_offset */ + + /* A regular 32 bit absolute relocation */ + HOWTO (R_D30V_32_NORMAL, /* type */ + 0, /* rightshift */ + 4, /* 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_D30V_32_NORMAL", /* name */ + false, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + false), /* pcrel_offset */ + +}; + +static bfd_reloc_status_type +bfd_elf_d30v_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd, error_message) + bfd *abfd; + arelent *reloc_entry; + asymbol *symbol; + PTR data; + asection *input_section; + bfd *output_bfd; + char **error_message; +{ + bfd_vma relocation; + bfd_vma in1, in2; + bfd_reloc_status_type r; + asection *reloc_target_output_section; + bfd_size_type addr = reloc_entry->address; + bfd_reloc_status_type flag = bfd_reloc_ok; + bfd_vma output_base = 0; + reloc_howto_type *howto = reloc_entry->howto; + + r = bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data, + input_section, output_bfd, error_message); + if (r != bfd_reloc_continue) + return r; + + /* a hacked-up version of bfd_perform_reloc() follows */ + + /* Is the address of the relocation really within the section? */ + if (reloc_entry->address > input_section->_cooked_size) + return bfd_reloc_outofrange; + + /* Work out which section the relocation is targetted at and the + initial relocation command value. */ + + /* Get symbol value. (Common symbols are special.) */ + if (bfd_is_com_section (symbol->section)) + relocation = 0; + else + relocation = symbol->value; + + + reloc_target_output_section = symbol->section->output_section; + + /* Convert input-section-relative symbol value to absolute. */ + if (output_bfd) + output_base = 0; + else + output_base = reloc_target_output_section->vma; + + relocation += output_base + symbol->section->output_offset; + + /* Add in supplied addend. */ + relocation += reloc_entry->addend; + + /* Here the variable relocation holds the final address of the + symbol we are relocating against, plus any addend. */ + + if (howto->pc_relative == true) + { + relocation -= input_section->output_section->vma + input_section->output_offset; + + if (howto->pcrel_offset == true) + relocation -= reloc_entry->address; + } + + if (output_bfd != (bfd *) NULL) + { + /* This is a partial relocation, and we want to apply the relocation + to the reloc entry rather than the raw data. Modify the reloc + inplace to reflect what we now know. */ + reloc_entry->addend = relocation; + reloc_entry->address += input_section->output_offset; + return flag; + } + else + reloc_entry->addend = 0; + + in1 = bfd_get_32 (abfd, (bfd_byte *) data + addr); + in2 = bfd_get_32 (abfd, (bfd_byte *) data + addr + 4); + + printf("D30V 32-bit reloc at addr 0x%lx insn=0x%08x%08x\n",(long)relocation, (int)in1, (int)in2); + bfd_put_32 (abfd, in1, (bfd_byte *) data + addr); + bfd_put_32 (abfd, in2, (bfd_byte *) data + addr + 4); + + return flag; +} + +/* Map BFD reloc types to D30V ELF reloc types. */ + +struct d30v_reloc_map +{ + unsigned char bfd_reloc_val; + unsigned char elf_reloc_val; +}; + + +static const struct d30v_reloc_map d30v_reloc_map[] = +{ + { BFD_RELOC_NONE, R_D30V_NONE, }, + { BFD_RELOC_D30V_6, R_D30V_6 }, + { BFD_RELOC_D30V_15, R_D30V_15 }, + { BFD_RELOC_D30V_15_PCREL, R_D30V_15_PCREL }, + { BFD_RELOC_D30V_21, R_D30V_21 }, + { BFD_RELOC_D30V_21_PCREL, R_D30V_21_PCREL }, + { BFD_RELOC_D30V_32, R_D30V_32 }, + { BFD_RELOC_D30V_32_PCREL, R_D30V_32_PCREL }, + { BFD_RELOC_32, R_D30V_32_NORMAL }, +}; + +static reloc_howto_type * +bfd_elf32_bfd_reloc_type_lookup (abfd, code) + bfd *abfd; + bfd_reloc_code_real_type code; +{ + unsigned int i; + + for (i = 0; + i < sizeof (d30v_reloc_map) / sizeof (struct d30v_reloc_map); + i++) + { + if (d30v_reloc_map[i].bfd_reloc_val == code) + return &elf_d30v_howto_table[d30v_reloc_map[i].elf_reloc_val]; + } + + return NULL; +} + +/* Set the howto pointer for an D30V ELF reloc. */ + +static void +d30v_info_to_howto_rel (abfd, cache_ptr, dst) + bfd *abfd; + arelent *cache_ptr; + Elf32_Internal_Rel *dst; +{ + unsigned int r_type; + + r_type = ELF32_R_TYPE (dst->r_info); + BFD_ASSERT (r_type < (unsigned int) R_D30V_max); + cache_ptr->howto = &elf_d30v_howto_table[r_type]; +} + +#define ELF_ARCH bfd_arch_d30v +#define ELF_MACHINE_CODE EM_CYGNUS_D30V +#define ELF_MAXPAGESIZE 0x1000 + +#define TARGET_BIG_SYM bfd_elf32_d30v_vec +#define TARGET_BIG_NAME "elf32-d30v" + +#define elf_info_to_howto 0 +#define elf_info_to_howto_rel d30v_info_to_howto_rel +#define elf_backend_object_p 0 +#define elf_backend_final_write_processing 0 + +#include "elf32-target.h" diff --git a/bfd/libbfd.h b/bfd/libbfd.h index a373d72..2e5214c 100644 --- a/bfd/libbfd.h +++ b/bfd/libbfd.h @@ -636,6 +636,7 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", "BFD_RELOC_ALPHA_LITUSE", "BFD_RELOC_ALPHA_HINT", "BFD_RELOC_ALPHA_LINKAGE", + "BFD_RELOC_ALPHA_CODEADDR", "BFD_RELOC_MIPS_JMP", "BFD_RELOC_MIPS16_JMP", "BFD_RELOC_MIPS16_GPREL", @@ -749,6 +750,16 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", "BFD_RELOC_D10V_18_PCREL", /* end-sanitize-d10v */ +/* start-sanitize-d30v */ + "BFD_RELOC_D30V_6", + "BFD_RELOC_D30V_15", + "BFD_RELOC_D30V_15_PCREL", + "BFD_RELOC_D30V_21", + "BFD_RELOC_D30V_21_PCREL", + "BFD_RELOC_D30V_32", + "BFD_RELOC_D30V_32_PCREL", +/* end-sanitize-d30v */ + /* start-sanitize-m32r */ "BFD_RELOC_M32R_24", "BFD_RELOC_M32R_10_PCREL", diff --git a/bfd/reloc.c b/bfd/reloc.c index da45948..201f142 100644 --- a/bfd/reloc.c +++ b/bfd/reloc.c @@ -2269,6 +2269,46 @@ COMMENT {* end-sanitize-d10v *} COMMENT +{* start-sanitize-d30v *} +ENUM + BFD_RELOC_D30V_6 +ENUMDOC + Mitsubishi D30V relocs. + This is a 6-bit absolute reloc. +ENUM + BFD_RELOC_D30V_15 +ENUMDOC + Mitsubishi D30V relocs. + This is a 12-bit absolute reloc with the + right 3 bitsassumed to be 0. +ENUM + BFD_RELOC_D30V_15_PCREL +ENUMDOC + Mitsubishi D30V relocs. + This is a 12-bit pc-relative reloc with + the right 3 bits assumed to be 0. +ENUM + BFD_RELOC_D30V_21 +ENUMDOC + This is an 18-bit absolute reloc with + the right 3 bits assumed to be 0. +ENUM + BFD_RELOC_D30V_21_PCREL +ENUMDOC + This is an 18-bit pc-relative reloc with + the right 3 bits assumed to be 0. +ENUM + BFD_RELOC_D30V_32 +ENUMDOC + This is a 32-bit absolute reloc. +ENUM + BFD_RELOC_D30V_32_PCREL +ENUMDOC + This is a 32-bit pc-relative reloc. +COMMENT +{* end-sanitize-d30v *} + +COMMENT {* start-sanitize-m32r *} ENUM BFD_RELOC_M32R_24 diff --git a/bfd/targets.c b/bfd/targets.c index 964e656..82cfef5 100644 --- a/bfd/targets.c +++ b/bfd/targets.c @@ -21,6 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "bfd.h" #include "sysdep.h" #include "libbfd.h" +#include "fnmatch.h" /* SECTION @@ -492,6 +493,9 @@ extern const bfd_target bfd_elf64_bigmips_vec; /* start-sanitize-d10v */ extern const bfd_target bfd_elf32_d10v_vec; /* end-sanitize-d10v */ +/* start-sanitize-d30v */ +extern const bfd_target bfd_elf32_d30v_vec; +/* end-sanitize-d30v */ extern const bfd_target bfd_elf32_hppa_vec; extern const bfd_target bfd_elf32_i386_vec; extern const bfd_target bfd_elf32_i860_vec; @@ -581,6 +585,9 @@ extern const bfd_target sparcnetbsd_vec; extern const bfd_target sparccoff_vec; extern const bfd_target sunos_big_vec; extern const bfd_target tekhex_vec; +/* start-sanitize-tic80 */ +extern const bfd_target tic80coff_vec; +/* end-sanitize-tic80 */ extern const bfd_target versados_vec; extern const bfd_target we32kcoff_vec; extern const bfd_target w65_vec; @@ -651,6 +658,9 @@ const bfd_target * const bfd_target_vector[] = { /* start-sanitize-d10v */ &bfd_elf32_d10v_vec, /* end-sanitize-d10v */ +/* start-sanitize-d30v */ + &bfd_elf32_d30v_vec, +/* end-sanitize-d30v */ &bfd_elf32_hppa_vec, &bfd_elf32_i386_vec, &bfd_elf32_i860_vec, @@ -791,6 +801,9 @@ const bfd_target * const bfd_target_vector[] = { &sunos_big_vec, &aout0_big_vec, &tekhex_vec, +/* start-sanitize-tic80 */ + &tic80coff_vec, +/* end-sanitize-tic80 */ &we32kcoff_vec, &versados_vec, &z8kcoff_vec, @@ -850,6 +863,27 @@ const bfd_target * const bfd_default_vector[] = { 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 +{ + /* The configuration triplet. */ + const char *triplet; + /* The BFD vector. If this is NULL, then the vector is found by + searching forward for the next structure with a non NULL vector + field. If this is UNSUPPORTED_TARGET, then the target is not + supported. */ + const bfd_target *vector; +}; + +#define UNSUPPORTED_TARGET ((const bfd_target *) 1) + +/* targmatch.h is built by Makefile out of config.bfd. */ +static const struct targmatch bfd_target_match[] = { +#include "targmatch.h" + { NULL, NULL } +}; + /* FUNCTION bfd_find_target @@ -871,28 +905,57 @@ DESCRIPTION const bfd_target * bfd_find_target (target_name, abfd) - CONST char *target_name; + const char *target_name; bfd *abfd; { const bfd_target * const *target; - extern char *getenv (); - CONST char *targname = (target_name ? target_name : - (CONST char *) getenv ("GNUTARGET")); + const char *targname; + const struct targmatch *match; + + if (target_name != NULL) + targname = target_name; + else + targname = getenv ("GNUTARGET"); /* This is safe; the vector cannot be null */ - if (targname == NULL || !strcmp (targname, "default")) { - abfd->target_defaulted = true; - return abfd->xvec = bfd_target_vector[0]; - } + if (targname == NULL || strcmp (targname, "default") == 0) + { + abfd->target_defaulted = true; + abfd->xvec = bfd_target_vector[0]; + return bfd_target_vector[0]; + } abfd->target_defaulted = false; - for (target = &bfd_target_vector[0]; *target != NULL; target++) { - if (!strcmp (targname, (*target)->name)) - return abfd->xvec = *target; - } + 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); + return NULL; } -- 2.7.4