[binutils-gdb] Fix 64-bit BFD detection causing build failures

Maciej W. Rozycki macro@sourceware.org
Mon Apr 28 17:57:38 GMT 2025


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=d9639e091c77689b10363ecb197466deaa161ade

commit d9639e091c77689b10363ecb197466deaa161ade
Author: Maciej W. Rozycki <macro@redhat.com>
Date:   Mon Apr 28 18:53:30 2025 +0100

    Fix 64-bit BFD detection causing build failures
    
    We have a discrepancy with 64-bit BFD handling across our component
    subdirectories leading to link failures such as:
    
    ld: ../opcodes/.libs/libopcodes.a(disassemble.o): in function `disassembler': disassemble.c:(.text+0x65): undefined reference to `print_insn_alpha'
    ld: disassemble.c:(.text+0x105): undefined reference to `print_insn_ia64'
    ld: disassemble.c:(.text+0x11d): undefined reference to `print_insn_loongarch'
    ld: disassemble.c:(.text+0x1a1): undefined reference to `print_insn_big_mips'
    [...]
    
    with some configurations having a 32-bit host and 64-bit BFD, such as:
    `--host=i386-linux-gnu --target=riscv64-linux-gnu --enable-targets=all'.
    This is ultimately due to how 64-bit BFD is enabled for bfd/ itself and
    other subdirectorses and has been a regression from commit 1d5269c994bf
    ("unify 64-bit bfd checks").
    
    For bfd/ the BFD_64_BIT autoconf macro from config/bfd64.m4 is used
    combined with this logic in bfd/configure.ac:
    
    case ${host64}-${target64}-${want64} in
      *true*)
        wordsize=64
        bfd64_libs='$(BFD64_LIBS)'
        all_backends='$(BFD64_BACKENDS) $(BFD32_BACKENDS)'
        [...]
        ;;
      false-false-false)
        wordsize=32
        all_backends='$(BFD32_BACKENDS)'
        ;;
    esac
    
    where the value of ${wordsize} switches between 32-bit and 64-bit BFD
    via these pieces:
    
    #define BFD_ARCH_SIZE @wordsize@
    
    and:
    
    #if BFD_ARCH_SIZE >= 64
    #define BFD64
    #endif
    
    in bfd/bfd-in.h, which ultimately becomes a part of "bfd.h".
    
    Then ${host64} is determined in bfd/configure.ac from the host's word
    size, via the host's pointer size:
    
    if test "x${ac_cv_sizeof_void_p}" = "x8"; then
      host64=true
    fi
    
    And ${target64} is determined in bfd/configure.ac from the target's word
    size:
    
        if test ${target_size} = 64; then
            target64=true
        fi
    
    Where multiple targets have been requested with `--enable-targets=all'
    the presence of any 64-bit target will set "true" here.
    
    Finally ${want64} is set according to `--enable-64-bit-bfd' user option
    with an arrangement involving BFD_64_BIT:
    
    BFD_64_BIT
    if test $enable_64_bit_bfd = yes ; then
      want64=true
    else
      want64=false
    fi
    
    which also, redundantly, checks and sets its result upon the host's word
    size.  Lastly ${want64} is also selectively set by target fragments in
    bfd/config.bfd, which mostly if not completely overlaps with ${target64}
    setting as described above.
    
    Conversely other subdirectories only rely on BFD_64_BIT, so they fail to
    notice that BFD is 64-bit and do not enable their 64-bit handling where
    the host requested is 32-bit and 64-bit BFD has been enabled other than
    with `--enable-64-bit-bfd'.  One consequence is opcodes/disassemble.c
    enables calls to its numerous own 64-bit backends by checking the BFD64
    macro from "bfd.h", however does not actually enable said backends in
    its Makefile.  Hence the link errors quoted above.
    
    Address the problem then by moving the `--enable-64-bit-bfd' option back
    to bfd/configure.ac and remove the call to BFD_64_BIT from there and
    then rewrite the macro in terms of checking for the presence of BFD64
    macro in "bfd.h", which is the canonical way of determining whether BFD
    is 64-bit or not.
    
    Rather than running `grep' directly on ../bfd/bfd-in3.h as the opcodes/
    fragment used to before the problematic commit:
    
        if grep '#define BFD_ARCH_SIZE 64' ../bfd/bfd-in3.h > /dev/null; then
    
    run the preprocessor on "bfd.h", which allows to invoke the macro from
    configure.ac files placed in subdirectories located at deeper levels, by
    relying on the preprocessor's search path.
    
    This requires however that the invokers rely on `all-bfd' rather than
    `configure-bfd' for their `configure' invocation stage, because "bfd.h"
    is made by `make all' rather than `configure' in bfd/.
    
    Do not cache the result of this check however, as reconfiguring a tree
    such as to flip `--enable-64-bit-bfd' on or to change a secondary target
    may affect BFD64 and we have no access to information about secondary
    targets in BFD_64_BIT.
    
    Also remove the ENABLE_BFD_64_BIT automake conditional, as it's not used
    anywhere.
    
    Last but not least remove the hack from gdb/configure.ac to fail builds
    for `mips*-*-*' hosts where `--enable-targets=all' has been requested,
    but `--enable-64-bit-bfd' has not as it's no longer needed.  Such builds
    complete successfully now, having enabled 64-bit BFD implicitly.
    
    Tested-By: Guinevere Larsen <guinevere@redhat.com>
    Tested-By: Luis Machado <luis.machado@arm.com>
    Approved-By: Alan Modra <amodra@gmail.com>
    Approved-By: Luis Machado <luis.machado@arm.com>

Diff:
---
 Makefile.def         |   4 +-
 Makefile.in          |  40 +++----
 bfd/configure        |  60 +----------
 bfd/configure.ac     |   8 +-
 config/bfd64.m4      |  38 ++++---
 gdb/configure        | 117 +++++++--------------
 gdb/configure.ac     |  15 +--
 gdb/configure.tgt    |   8 +-
 ld/configure         | 291 +++++++--------------------------------------------
 ld/configure.ac      |   6 +-
 opcodes/configure    | 287 ++++++--------------------------------------------
 opcodes/configure.ac |   2 +-
 12 files changed, 166 insertions(+), 710 deletions(-)

diff --git a/Makefile.def b/Makefile.def
index 4896c5c692c..93485c71ac3 100644
--- a/Makefile.def
+++ b/Makefile.def
@@ -523,7 +523,7 @@ dependencies = { module=install-bfd; on=install-libsframe; };
 dependencies = { module=install-strip-bfd; on=install-strip-libsframe; };
 
 // libopcodes depends on libbfd
-dependencies = { module=configure-opcodes; on=configure-bfd; hard=true; };
+dependencies = { module=configure-opcodes; on=all-bfd; hard=true; };
 dependencies = { module=install-opcodes; on=install-bfd; };
 dependencies = { module=install-strip-opcodes; on=install-strip-bfd; };
 
@@ -549,8 +549,8 @@ dependencies = { module=install-gprofng; on=install-opcodes; };
 dependencies = { module=install-gprofng; on=install-bfd; };
 
 dependencies = { module=configure-ld; on=configure-gettext; };
+dependencies = { module=configure-ld; on=all-bfd; };
 dependencies = { module=all-ld; on=all-libiberty; };
-dependencies = { module=all-ld; on=all-bfd; };
 dependencies = { module=all-ld; on=all-opcodes; };
 dependencies = { module=all-ld; on=all-build-bison; };
 dependencies = { module=all-ld; on=all-build-flex; };
diff --git a/Makefile.in b/Makefile.in
index f12c251f9c8..2a536168b3e 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -67369,16 +67369,16 @@ install-strip-ld: maybe-install-strip-bfd
 install-strip-ld: maybe-install-strip-libctf
 install-bfd: maybe-install-libsframe
 install-strip-bfd: maybe-install-strip-libsframe
-configure-opcodes: configure-bfd
-configure-stage1-opcodes: configure-stage1-bfd
-configure-stage2-opcodes: configure-stage2-bfd
-configure-stage3-opcodes: configure-stage3-bfd
-configure-stage4-opcodes: configure-stage4-bfd
-configure-stageprofile-opcodes: configure-stageprofile-bfd
-configure-stagetrain-opcodes: configure-stagetrain-bfd
-configure-stagefeedback-opcodes: configure-stagefeedback-bfd
-configure-stageautoprofile-opcodes: configure-stageautoprofile-bfd
-configure-stageautofeedback-opcodes: configure-stageautofeedback-bfd
+configure-opcodes: all-bfd
+configure-stage1-opcodes: all-stage1-bfd
+configure-stage2-opcodes: all-stage2-bfd
+configure-stage3-opcodes: all-stage3-bfd
+configure-stage4-opcodes: all-stage4-bfd
+configure-stageprofile-opcodes: all-stageprofile-bfd
+configure-stagetrain-opcodes: all-stagetrain-bfd
+configure-stagefeedback-opcodes: all-stagefeedback-bfd
+configure-stageautoprofile-opcodes: all-stageautoprofile-bfd
+configure-stageautofeedback-opcodes: all-stageautofeedback-bfd
 install-opcodes: maybe-install-bfd
 install-strip-opcodes: maybe-install-strip-bfd
 configure-gas: maybe-configure-gettext
@@ -67443,6 +67443,16 @@ configure-stagetrain-ld: maybe-configure-stagetrain-gettext
 configure-stagefeedback-ld: maybe-configure-stagefeedback-gettext
 configure-stageautoprofile-ld: maybe-configure-stageautoprofile-gettext
 configure-stageautofeedback-ld: maybe-configure-stageautofeedback-gettext
+configure-ld: maybe-all-bfd
+configure-stage1-ld: maybe-all-stage1-bfd
+configure-stage2-ld: maybe-all-stage2-bfd
+configure-stage3-ld: maybe-all-stage3-bfd
+configure-stage4-ld: maybe-all-stage4-bfd
+configure-stageprofile-ld: maybe-all-stageprofile-bfd
+configure-stagetrain-ld: maybe-all-stagetrain-bfd
+configure-stagefeedback-ld: maybe-all-stagefeedback-bfd
+configure-stageautoprofile-ld: maybe-all-stageautoprofile-bfd
+configure-stageautofeedback-ld: maybe-all-stageautofeedback-bfd
 all-ld: maybe-all-libiberty
 all-stage1-ld: maybe-all-stage1-libiberty
 all-stage2-ld: maybe-all-stage2-libiberty
@@ -67453,16 +67463,6 @@ all-stagetrain-ld: maybe-all-stagetrain-libiberty
 all-stagefeedback-ld: maybe-all-stagefeedback-libiberty
 all-stageautoprofile-ld: maybe-all-stageautoprofile-libiberty
 all-stageautofeedback-ld: maybe-all-stageautofeedback-libiberty
-all-ld: maybe-all-bfd
-all-stage1-ld: maybe-all-stage1-bfd
-all-stage2-ld: maybe-all-stage2-bfd
-all-stage3-ld: maybe-all-stage3-bfd
-all-stage4-ld: maybe-all-stage4-bfd
-all-stageprofile-ld: maybe-all-stageprofile-bfd
-all-stagetrain-ld: maybe-all-stagetrain-bfd
-all-stagefeedback-ld: maybe-all-stagefeedback-bfd
-all-stageautoprofile-ld: maybe-all-stageautoprofile-bfd
-all-stageautofeedback-ld: maybe-all-stageautofeedback-bfd
 all-ld: maybe-all-opcodes
 all-stage1-ld: maybe-all-stage1-opcodes
 all-stage2-ld: maybe-all-stage2-opcodes
diff --git a/bfd/configure b/bfd/configure
index ca7f66f9352..f69df1272d2 100755
--- a/bfd/configure
+++ b/bfd/configure
@@ -702,8 +702,6 @@ REPORT_BUGS_TEXI
 REPORT_BUGS_TO
 PKGVERSION
 DEBUGDIR
-ENABLE_BFD_64_BIT_FALSE
-ENABLE_BFD_64_BIT_TRUE
 PLUGINS_FALSE
 PLUGINS_TRUE
 LARGEFILE_CPPFLAGS
@@ -11155,7 +11153,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11158 "configure"
+#line 11156 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11261,7 +11259,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11264 "configure"
+#line 11262 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11930,56 +11928,6 @@ else
   enable_64_bit_bfd=no
 fi
 
-
-if test "x$enable_64_bit_bfd" = "xno"; then :
-    # The cast to long int works around a bug in the HP C Compiler
-# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
-# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
-# This bug is HP SR number 8606223364.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of void *" >&5
-$as_echo_n "checking size of void *... " >&6; }
-if ${ac_cv_sizeof_void_p+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (void *))" "ac_cv_sizeof_void_p"        "$ac_includes_default"; then :
-
-else
-  if test "$ac_cv_type_void_p" = yes; then
-     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error 77 "cannot compute sizeof (void *)
-See \`config.log' for more details" "$LINENO" 5; }
-   else
-     ac_cv_sizeof_void_p=0
-   fi
-fi
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_void_p" >&5
-$as_echo "$ac_cv_sizeof_void_p" >&6; }
-
-
-
-cat >>confdefs.h <<_ACEOF
-#define SIZEOF_VOID_P $ac_cv_sizeof_void_p
-_ACEOF
-
-
-  if test "x$ac_cv_sizeof_void_p" = "x8"; then :
-  enable_64_bit_bfd=yes
-fi
-
-fi
-
- if test "x$enable_64_bit_bfd" = "xyes"; then
-  ENABLE_BFD_64_BIT_TRUE=
-  ENABLE_BFD_64_BIT_FALSE='#'
-else
-  ENABLE_BFD_64_BIT_TRUE='#'
-  ENABLE_BFD_64_BIT_FALSE=
-fi
-
-
 if test $enable_64_bit_bfd = yes ; then
   want64=true
 else
@@ -17677,10 +17625,6 @@ if test -z "${PLUGINS_TRUE}" && test -z "${PLUGINS_FALSE}"; then
   as_fn_error $? "conditional \"PLUGINS\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
-if test -z "${ENABLE_BFD_64_BIT_TRUE}" && test -z "${ENABLE_BFD_64_BIT_FALSE}"; then
-  as_fn_error $? "conditional \"ENABLE_BFD_64_BIT\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5
-fi
 if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
   as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/bfd/configure.ac b/bfd/configure.ac
index 90fad5417b3..e9942d215b0 100644
--- a/bfd/configure.ac
+++ b/bfd/configure.ac
@@ -81,7 +81,13 @@ if test x$ac_checking != x ; then
   AC_DEFINE(ENABLE_CHECKING, 1, [Define if you want run-time sanity checks.])
 fi
 
-BFD_64_BIT
+AC_ARG_ENABLE(64-bit-bfd,
+  AS_HELP_STRING([--enable-64-bit-bfd],
+		 [64-bit support (on hosts with narrower word sizes)]),
+  [AS_CASE([$enableval],
+	   [yes|no], [],
+	   [*], [AC_MSG_ERROR(bad value ${enableval} for 64-bit-bfd option)])],
+  [enable_64_bit_bfd=no])
 if test $enable_64_bit_bfd = yes ; then
   want64=true
 else
diff --git a/config/bfd64.m4 b/config/bfd64.m4
index d134f1a5765..d816f7f5dd8 100644
--- a/config/bfd64.m4
+++ b/config/bfd64.m4
@@ -16,21 +16,25 @@ dnl along with this program; see the file COPYING3.  If not see
 dnl <http://www.gnu.org/licenses/>.
 dnl
 
-dnl See whether 64-bit bfd lib has been enabled.
+dnl Make sure your module depends on `all-bfd' when invoking this macro.
 AC_DEFUN([BFD_64_BIT], [dnl
-AC_ARG_ENABLE(64-bit-bfd,
-  AS_HELP_STRING([--enable-64-bit-bfd],
-		 [64-bit support (on hosts with narrower word sizes)]),
-  [AS_CASE([$enableval],
-	   [yes|no], [],
-	   [*], [AC_MSG_ERROR(bad value ${enableval} for 64-bit-bfd option)])],
-  [enable_64_bit_bfd=no])
-
-dnl If the host is 64-bit, then 64-bit bfd is enabled automatically.
-AS_IF([test "x$enable_64_bit_bfd" = "xno"], [dnl
-  AC_CHECK_SIZEOF(void *)
-  AS_IF([test "x$ac_cv_sizeof_void_p" = "x8"], [enable_64_bit_bfd=yes])
-])
-
-AM_CONDITIONAL([ENABLE_BFD_64_BIT], [test "x$enable_64_bit_bfd" = "xyes"])
-])
+# See whether 64-bit bfd lib has been enabled.
+OLD_CPPFLAGS=$CPPFLAGS
+# Put the old CPPFLAGS last, in case the user's CPPFLAGS point somewhere
+# with bfd, with -I/foo/include.  We always want our bfd.
+CPPFLAGS="-I${srcdir}/../include -I../bfd -I${srcdir}/../bfd $CPPFLAGS"
+# Note we cannot cache the result of this check because BFD64 may change
+# when a secondary target has been added or removed and we have no access
+# to this information here.
+AC_MSG_CHECKING([whether BFD is 64-bit])
+AC_EGREP_CPP([HAVE_BFD64],
+  AC_LANG_PROGRAM(
+    [#include "bfd.h"],
+    [dnl
+#ifdef BFD64
+HAVE_BFD64
+#endif]),
+  [have_64_bit_bfd=yes],
+  [have_64_bit_bfd=no])
+AC_MSG_RESULT([$have_64_bit_bfd])
+CPPFLAGS=$OLD_CPPFLAGS])
diff --git a/gdb/configure b/gdb/configure
index c029c303176..5ee198285b8 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -761,8 +761,6 @@ TARGET_OBS
 AMD_DBGAPI_LIBS
 AMD_DBGAPI_CFLAGS
 HAVE_GSTACK
-ENABLE_BFD_64_BIT_FALSE
-ENABLE_BFD_64_BIT_TRUE
 subdirs
 GDB_DATADIR
 DEBUGDIR
@@ -934,7 +932,6 @@ with_relocated_sources
 with_auto_load_dir
 with_auto_load_safe_path
 enable_targets
-enable_64_bit_bfd
 with_amd_dbgapi
 enable_tui
 enable_gdbtk
@@ -1646,7 +1643,6 @@ Optional Features:
   --disable-nls           do not use Native Language Support
   --enable-targets=TARGETS
                           alternative target configurations
-  --enable-64-bit-bfd     64-bit support (on hosts with narrower word sizes)
   --enable-tui            enable full-screen terminal user interface (TUI)
   --enable-gdbtk          enable gdbtk graphical user interface (GUI)
   --enable-profiling      enable profiling of GDB
@@ -11503,7 +11499,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11506 "configure"
+#line 11502 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11609,7 +11605,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11612 "configure"
+#line 11608 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -24879,70 +24875,40 @@ fi
 
 
 
-# Check whether --enable-64-bit-bfd was given.
-if test "${enable_64_bit_bfd+set}" = set; then :
-  enableval=$enable_64_bit_bfd; case $enableval in #(
-  yes|no) :
-     ;; #(
-  *) :
-    as_fn_error $? "bad value ${enableval} for 64-bit-bfd option" "$LINENO" 5 ;; #(
-  *) :
-     ;;
-esac
-else
-  enable_64_bit_bfd=no
-fi
-
-
-if test "x$enable_64_bit_bfd" = "xno"; then :
-    # The cast to long int works around a bug in the HP C Compiler
-# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
-# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
-# This bug is HP SR number 8606223364.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of void *" >&5
-$as_echo_n "checking size of void *... " >&6; }
-if ${ac_cv_sizeof_void_p+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (void *))" "ac_cv_sizeof_void_p"        "$ac_includes_default"; then :
-
-else
-  if test "$ac_cv_type_void_p" = yes; then
-     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error 77 "cannot compute sizeof (void *)
-See \`config.log' for more details" "$LINENO" 5; }
-   else
-     ac_cv_sizeof_void_p=0
-   fi
-fi
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_void_p" >&5
-$as_echo "$ac_cv_sizeof_void_p" >&6; }
-
-
-
-cat >>confdefs.h <<_ACEOF
-#define SIZEOF_VOID_P $ac_cv_sizeof_void_p
+# See whether 64-bit bfd lib has been enabled.
+OLD_CPPFLAGS=$CPPFLAGS
+# Put the old CPPFLAGS last, in case the user's CPPFLAGS point somewhere
+# with bfd, with -I/foo/include.  We always want our bfd.
+CPPFLAGS="-I${srcdir}/../include -I../bfd -I${srcdir}/../bfd $CPPFLAGS"
+# Note we cannot cache the result of this check because BFD64 may change
+# when a secondary target has been added or removed and we have no access
+# to this information here.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether BFD is 64-bit" >&5
+$as_echo_n "checking whether BFD is 64-bit... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include "bfd.h"
+int
+main ()
+{
+#ifdef BFD64
+HAVE_BFD64
+#endif
+  ;
+  return 0;
+}
 _ACEOF
-
-
-  if test "x$ac_cv_sizeof_void_p" = "x8"; then :
-  enable_64_bit_bfd=yes
-fi
-
-fi
-
- if test "x$enable_64_bit_bfd" = "xyes"; then
-  ENABLE_BFD_64_BIT_TRUE=
-  ENABLE_BFD_64_BIT_FALSE='#'
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "HAVE_BFD64" >/dev/null 2>&1; then :
+  have_64_bit_bfd=yes
 else
-  ENABLE_BFD_64_BIT_TRUE='#'
-  ENABLE_BFD_64_BIT_FALSE=
+  have_64_bit_bfd=no
 fi
+rm -f conftest*
 
-
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_64_bit_bfd" >&5
+$as_echo "$have_64_bit_bfd" >&6; }
+CPPFLAGS=$OLD_CPPFLAGS
 
 # Provide defaults for some variables set by the per-host and per-target
 # configuration.
@@ -24992,7 +24958,7 @@ fi
     done
 
     # Check whether this target needs 64-bit CORE_ADDR
-    if test x${enable_64_bit_bfd} = xno; then
+    if test x${have_64_bit_bfd} = xno; then
       . ${srcdir}/../bfd/config.bfd
     fi
 
@@ -25005,19 +24971,10 @@ fi
 done
 
 if test x${all_targets} = xtrue; then
-  if test x${enable_64_bit_bfd} = xyes; then
+  if test x${have_64_bit_bfd} = xyes; then
     TARGET_OBS='$(ALL_TARGET_OBS) $(ALL_64_TARGET_OBS)'
   else
-    case ${host} in
-    mips*)
-      # If all targets were requested, but 64 bit bfd is not enabled,
-      # the build will fail. See PR 28684.
-      as_fn_error $? "--enable-targets=all requires --enable-64-bit-bfd" "$LINENO" 5
-      ;;
-    *)
-      TARGET_OBS='$(ALL_TARGET_OBS)'
-      ;;
-    esac
+    TARGET_OBS='$(ALL_TARGET_OBS)'
   fi
 fi
 
@@ -33946,10 +33903,6 @@ if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
   as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
-if test -z "${ENABLE_BFD_64_BIT_TRUE}" && test -z "${ENABLE_BFD_64_BIT_FALSE}"; then
-  as_fn_error $? "conditional \"ENABLE_BFD_64_BIT\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5
-fi
 if test -z "${HAVE_PYTHON_TRUE}" && test -z "${HAVE_PYTHON_FALSE}"; then
   as_fn_error $? "conditional \"HAVE_PYTHON\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/gdb/configure.ac b/gdb/configure.ac
index 7ba799b2c48..5870a618349 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -241,7 +241,7 @@ do
     done
 
     # Check whether this target needs 64-bit CORE_ADDR
-    if test x${enable_64_bit_bfd} = xno; then
+    if test x${have_64_bit_bfd} = xno; then
       . ${srcdir}/../bfd/config.bfd
     fi
 
@@ -254,19 +254,10 @@ do
 done
 
 if test x${all_targets} = xtrue; then
-  if test x${enable_64_bit_bfd} = xyes; then
+  if test x${have_64_bit_bfd} = xyes; then
     TARGET_OBS='$(ALL_TARGET_OBS) $(ALL_64_TARGET_OBS)'
   else
-    case ${host} in
-    mips*)
-      # If all targets were requested, but 64 bit bfd is not enabled,
-      # the build will fail. See PR 28684.
-      AC_MSG_ERROR([--enable-targets=all requires --enable-64-bit-bfd])
-      ;;
-    *)
-      TARGET_OBS='$(ALL_TARGET_OBS)'
-      ;;
-    esac
+    TARGET_OBS='$(ALL_TARGET_OBS)'
   fi
 fi
 
diff --git a/gdb/configure.tgt b/gdb/configure.tgt
index 72cdceeaed9..e9b306809dc 100644
--- a/gdb/configure.tgt
+++ b/gdb/configure.tgt
@@ -85,7 +85,7 @@ hppa*-*-*)
 
 i[34567]86-*-*)
 	cpu_obs="${i386_tobjs}"
-	if test "x$enable_64_bit_bfd" = "xyes"; then
+	if test "x$have_64_bit_bfd" = "xyes"; then
 	   cpu_obs="${amd64_tobjs} ${cpu_obs}"
 	fi
 	;;
@@ -284,7 +284,7 @@ hppa*-*-openbsd*)
 i[34567]86-*-darwin*)
 	# Target: Darwin/i386
 	gdb_target_obs="i386-darwin-tdep.o solib-darwin.o"
-	if test "x$enable_64_bit_bfd" = "xyes"; then
+	if test "x$have_64_bit_bfd" = "xyes"; then
 	    # Target: GNU/Linux x86-64
 	    gdb_target_obs="amd64-darwin-tdep.o ${gdb_target_obs}"
 	fi
@@ -319,7 +319,7 @@ i[34567]86-*-linux*)
 			linux-tdep.o linux-record.o \
 			arch/i386-linux-tdesc.o \
 			arch/x86-linux-tdesc-features.o"
-	if test "x$enable_64_bit_bfd" = "xyes"; then
+	if test "x$have_64_bit_bfd" = "xyes"; then
 	    # Target: GNU/Linux x86-64
 	    gdb_target_obs="amd64-linux-tdep.o \
 			    arch/amd64-linux-tdesc.o ${gdb_target_obs}"
@@ -580,7 +580,7 @@ sparc-*-linux*)
 			sparc-linux-tdep.o solib-svr4.o symfile-mem.o \
 			linux-tdep.o \
 			ravenscar-thread.o sparc-ravenscar-thread.o"
-	if test "x$enable_64_bit_bfd" = "xyes"; then
+	if test "x$have_64_bit_bfd" = "xyes"; then
 	    # Target: GNU/Linux UltraSPARC
 	    gdb_target_obs="sparc64-tdep.o \
 			    sparc64-linux-tdep.o ${gdb_target_obs}"
diff --git a/ld/configure b/ld/configure
index 3f745ac883e..64b42f13fb3 100755
--- a/ld/configure
+++ b/ld/configure
@@ -696,8 +696,6 @@ install_as_default
 TARGET_SYSTEM_ROOT_DEFINE
 TARGET_SYSTEM_ROOT
 use_sysroot
-ENABLE_BFD_64_BIT_FALSE
-ENABLE_BFD_64_BIT_TRUE
 LARGEFILE_CPPFLAGS
 CXXCPP
 OTOOL64
@@ -842,7 +840,6 @@ enable_largefile
 enable_checking
 with_lib_path
 enable_targets
-enable_64_bit_bfd
 with_sysroot
 enable_gold
 enable_got
@@ -1536,7 +1533,6 @@ Optional Features:
   --disable-largefile     omit support for large files
   --enable-checking       enable run-time checks
   --enable-targets        alternative target configurations
-  --enable-64-bit-bfd     64-bit support (on hosts with narrower word sizes)
   --enable-gold[=ARG]     build gold [ARG={default,yes,no}]
   --enable-got=<type>     GOT handling scheme (target, single, negative,
                           multigot)
@@ -2177,189 +2173,6 @@ fi
 
 } # ac_fn_cxx_try_link
 
-# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES
-# --------------------------------------------
-# Tries to find the compile-time value of EXPR in a program that includes
-# INCLUDES, setting VAR accordingly. Returns whether the value could be
-# computed
-ac_fn_c_compute_int ()
-{
-  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  if test "$cross_compiling" = yes; then
-    # Depending upon the size, compute the lo and hi bounds.
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$4
-int
-main ()
-{
-static int test_array [1 - 2 * !(($2) >= 0)];
-test_array [0] = 0;
-return test_array [0];
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_lo=0 ac_mid=0
-  while :; do
-    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$4
-int
-main ()
-{
-static int test_array [1 - 2 * !(($2) <= $ac_mid)];
-test_array [0] = 0;
-return test_array [0];
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_hi=$ac_mid; break
-else
-  as_fn_arith $ac_mid + 1 && ac_lo=$as_val
-			if test $ac_lo -le $ac_mid; then
-			  ac_lo= ac_hi=
-			  break
-			fi
-			as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$4
-int
-main ()
-{
-static int test_array [1 - 2 * !(($2) < 0)];
-test_array [0] = 0;
-return test_array [0];
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_hi=-1 ac_mid=-1
-  while :; do
-    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$4
-int
-main ()
-{
-static int test_array [1 - 2 * !(($2) >= $ac_mid)];
-test_array [0] = 0;
-return test_array [0];
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_lo=$ac_mid; break
-else
-  as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val
-			if test $ac_mid -le $ac_hi; then
-			  ac_lo= ac_hi=
-			  break
-			fi
-			as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
-else
-  ac_lo= ac_hi=
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-# Binary search between lo and hi bounds.
-while test "x$ac_lo" != "x$ac_hi"; do
-  as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$4
-int
-main ()
-{
-static int test_array [1 - 2 * !(($2) <= $ac_mid)];
-test_array [0] = 0;
-return test_array [0];
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_hi=$ac_mid
-else
-  as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-done
-case $ac_lo in #((
-?*) eval "$3=\$ac_lo"; ac_retval=0 ;;
-'') ac_retval=1 ;;
-esac
-  else
-    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$4
-static long int longval () { return $2; }
-static unsigned long int ulongval () { return $2; }
-#include <stdio.h>
-#include <stdlib.h>
-int
-main ()
-{
-
-  FILE *f = fopen ("conftest.val", "w");
-  if (! f)
-    return 1;
-  if (($2) < 0)
-    {
-      long int i = longval ();
-      if (i != ($2))
-	return 1;
-      fprintf (f, "%ld", i);
-    }
-  else
-    {
-      unsigned long int i = ulongval ();
-      if (i != ($2))
-	return 1;
-      fprintf (f, "%lu", i);
-    }
-  /* Do not output a trailing newline, as this causes \r\n confusion
-     on some platforms.  */
-  return ferror (f) || fclose (f) != 0;
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
-  echo >>conftest.val; read $3 <conftest.val; ac_retval=0
-else
-  ac_retval=1
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-  conftest.$ac_objext conftest.beam conftest.$ac_ext
-rm -f conftest.val
-
-  fi
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-  as_fn_set_status $ac_retval
-
-} # ac_fn_c_compute_int
-
 # ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES
 # ---------------------------------------------
 # Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR
@@ -11688,7 +11501,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11691 "configure"
+#line 11504 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11794,7 +11607,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11797 "configure"
+#line 11610 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -15462,70 +15275,40 @@ if test "${enable_targets+set}" = set; then :
 esac
 fi
 
-# Check whether --enable-64-bit-bfd was given.
-if test "${enable_64_bit_bfd+set}" = set; then :
-  enableval=$enable_64_bit_bfd; case $enableval in #(
-  yes|no) :
-     ;; #(
-  *) :
-    as_fn_error $? "bad value ${enableval} for 64-bit-bfd option" "$LINENO" 5 ;; #(
-  *) :
-     ;;
-esac
-else
-  enable_64_bit_bfd=no
-fi
-
-
-if test "x$enable_64_bit_bfd" = "xno"; then :
-    # The cast to long int works around a bug in the HP C Compiler
-# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
-# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
-# This bug is HP SR number 8606223364.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of void *" >&5
-$as_echo_n "checking size of void *... " >&6; }
-if ${ac_cv_sizeof_void_p+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (void *))" "ac_cv_sizeof_void_p"        "$ac_includes_default"; then :
-
-else
-  if test "$ac_cv_type_void_p" = yes; then
-     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error 77 "cannot compute sizeof (void *)
-See \`config.log' for more details" "$LINENO" 5; }
-   else
-     ac_cv_sizeof_void_p=0
-   fi
-fi
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_void_p" >&5
-$as_echo "$ac_cv_sizeof_void_p" >&6; }
-
-
-
-cat >>confdefs.h <<_ACEOF
-#define SIZEOF_VOID_P $ac_cv_sizeof_void_p
+# See whether 64-bit bfd lib has been enabled.
+OLD_CPPFLAGS=$CPPFLAGS
+# Put the old CPPFLAGS last, in case the user's CPPFLAGS point somewhere
+# with bfd, with -I/foo/include.  We always want our bfd.
+CPPFLAGS="-I${srcdir}/../include -I../bfd -I${srcdir}/../bfd $CPPFLAGS"
+# Note we cannot cache the result of this check because BFD64 may change
+# when a secondary target has been added or removed and we have no access
+# to this information here.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether BFD is 64-bit" >&5
+$as_echo_n "checking whether BFD is 64-bit... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include "bfd.h"
+int
+main ()
+{
+#ifdef BFD64
+HAVE_BFD64
+#endif
+  ;
+  return 0;
+}
 _ACEOF
-
-
-  if test "x$ac_cv_sizeof_void_p" = "x8"; then :
-  enable_64_bit_bfd=yes
-fi
-
-fi
-
- if test "x$enable_64_bit_bfd" = "xyes"; then
-  ENABLE_BFD_64_BIT_TRUE=
-  ENABLE_BFD_64_BIT_FALSE='#'
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "HAVE_BFD64" >/dev/null 2>&1; then :
+  have_64_bit_bfd=yes
 else
-  ENABLE_BFD_64_BIT_TRUE='#'
-  ENABLE_BFD_64_BIT_FALSE=
+  have_64_bit_bfd=no
 fi
+rm -f conftest*
 
-
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_64_bit_bfd" >&5
+$as_echo "$have_64_bit_bfd" >&6; }
+CPPFLAGS=$OLD_CPPFLAGS
 
 
 # Check whether --with-sysroot was given.
@@ -19306,11 +19089,11 @@ do
       EMUL=$targ_emul
     fi
 
-    if test x${enable_64_bit_bfd} = xno; then
+    if test x${have_64_bit_bfd} = xno; then
       . ${srcdir}/../bfd/config.bfd
     fi
 
-    if test x${enable_64_bit_bfd} = xyes; then
+    if test x${have_64_bit_bfd} = xyes; then
       targ_extra_emuls="$targ_extra_emuls $targ64_extra_emuls"
       targ_extra_libpath="$targ_extra_libpath $targ64_extra_libpath"
     fi
@@ -19534,7 +19317,7 @@ _ACEOF
 
 
 if test x${all_targets} = xtrue; then
-  if test x${enable_64_bit_bfd} = xyes; then
+  if test x${have_64_bit_bfd} = xyes; then
     EMULATION_OFILES='$(ALL_EMULATIONS) $(ALL_64_EMULATIONS)'
     EMUL_EXTRA_OFILES='$(ALL_EMUL_EXTRA_OFILES) $(ALL_64_EMUL_EXTRA_OFILES)'
   else
@@ -19737,10 +19520,6 @@ if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then
   as_fn_error $? "conditional \"am__fastdepCXX\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
-if test -z "${ENABLE_BFD_64_BIT_TRUE}" && test -z "${ENABLE_BFD_64_BIT_FALSE}"; then
-  as_fn_error $? "conditional \"ENABLE_BFD_64_BIT\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5
-fi
 if test -z "${ENABLE_LIBCTF_TRUE}" && test -z "${ENABLE_LIBCTF_FALSE}"; then
   as_fn_error $? "conditional \"ENABLE_LIBCTF\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/ld/configure.ac b/ld/configure.ac
index 1ee0c0c77f9..e5f56ddf1c1 100644
--- a/ld/configure.ac
+++ b/ld/configure.ac
@@ -495,11 +495,11 @@ do
       EMUL=$targ_emul
     fi
 
-    if test x${enable_64_bit_bfd} = xno; then
+    if test x${have_64_bit_bfd} = xno; then
       . ${srcdir}/../bfd/config.bfd
     fi
 
-    if test x${enable_64_bit_bfd} = xyes; then
+    if test x${have_64_bit_bfd} = xyes; then
       targ_extra_emuls="$targ_extra_emuls $targ64_extra_emuls"
       targ_extra_libpath="$targ_extra_libpath $targ64_extra_libpath"
     fi
@@ -686,7 +686,7 @@ AC_SUBST(TDIRS)
 AM_SUBST_NOTMAKE(TDIRS)
 
 if test x${all_targets} = xtrue; then
-  if test x${enable_64_bit_bfd} = xyes; then
+  if test x${have_64_bit_bfd} = xyes; then
     EMULATION_OFILES='$(ALL_EMULATIONS) $(ALL_64_EMULATIONS)'
     EMUL_EXTRA_OFILES='$(ALL_EMUL_EXTRA_OFILES) $(ALL_64_EMUL_EXTRA_OFILES)'
   else
diff --git a/opcodes/configure b/opcodes/configure
index 554a0709c0a..4b6e96545fa 100755
--- a/opcodes/configure
+++ b/opcodes/configure
@@ -646,8 +646,6 @@ cgendir
 CGEN_MAINT_FALSE
 CGEN_MAINT_TRUE
 HDEFINES
-ENABLE_BFD_64_BIT_FALSE
-ENABLE_BFD_64_BIT_TRUE
 EXEEXT_FOR_BUILD
 CC_FOR_BUILD
 CATOBJEXT
@@ -819,7 +817,6 @@ with_libiconv_prefix
 with_libiconv_type
 with_libintl_prefix
 with_libintl_type
-enable_64_bit_bfd
 enable_cgen_maint
 '
       ac_precious_vars='build_alias
@@ -1471,7 +1468,6 @@ Optional Features:
   --enable-install-libbfd controls installation of libbfd and related headers
   --disable-nls           do not use Native Language Support
   --disable-rpath         do not hardcode runtime library paths
-  --enable-64-bit-bfd     64-bit support (on hosts with narrower word sizes)
   --enable-cgen-maint=dir    build cgen generated files
 
 Optional Packages:
@@ -1926,189 +1922,6 @@ $as_echo "$ac_res" >&6; }
 
 } # ac_fn_c_check_func
 
-# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES
-# --------------------------------------------
-# Tries to find the compile-time value of EXPR in a program that includes
-# INCLUDES, setting VAR accordingly. Returns whether the value could be
-# computed
-ac_fn_c_compute_int ()
-{
-  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  if test "$cross_compiling" = yes; then
-    # Depending upon the size, compute the lo and hi bounds.
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$4
-int
-main ()
-{
-static int test_array [1 - 2 * !(($2) >= 0)];
-test_array [0] = 0;
-return test_array [0];
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_lo=0 ac_mid=0
-  while :; do
-    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$4
-int
-main ()
-{
-static int test_array [1 - 2 * !(($2) <= $ac_mid)];
-test_array [0] = 0;
-return test_array [0];
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_hi=$ac_mid; break
-else
-  as_fn_arith $ac_mid + 1 && ac_lo=$as_val
-			if test $ac_lo -le $ac_mid; then
-			  ac_lo= ac_hi=
-			  break
-			fi
-			as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$4
-int
-main ()
-{
-static int test_array [1 - 2 * !(($2) < 0)];
-test_array [0] = 0;
-return test_array [0];
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_hi=-1 ac_mid=-1
-  while :; do
-    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$4
-int
-main ()
-{
-static int test_array [1 - 2 * !(($2) >= $ac_mid)];
-test_array [0] = 0;
-return test_array [0];
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_lo=$ac_mid; break
-else
-  as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val
-			if test $ac_mid -le $ac_hi; then
-			  ac_lo= ac_hi=
-			  break
-			fi
-			as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
-else
-  ac_lo= ac_hi=
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-# Binary search between lo and hi bounds.
-while test "x$ac_lo" != "x$ac_hi"; do
-  as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$4
-int
-main ()
-{
-static int test_array [1 - 2 * !(($2) <= $ac_mid)];
-test_array [0] = 0;
-return test_array [0];
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_hi=$ac_mid
-else
-  as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-done
-case $ac_lo in #((
-?*) eval "$3=\$ac_lo"; ac_retval=0 ;;
-'') ac_retval=1 ;;
-esac
-  else
-    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$4
-static long int longval () { return $2; }
-static unsigned long int ulongval () { return $2; }
-#include <stdio.h>
-#include <stdlib.h>
-int
-main ()
-{
-
-  FILE *f = fopen ("conftest.val", "w");
-  if (! f)
-    return 1;
-  if (($2) < 0)
-    {
-      long int i = longval ();
-      if (i != ($2))
-	return 1;
-      fprintf (f, "%ld", i);
-    }
-  else
-    {
-      unsigned long int i = ulongval ();
-      if (i != ($2))
-	return 1;
-      fprintf (f, "%lu", i);
-    }
-  /* Do not output a trailing newline, as this causes \r\n confusion
-     on some platforms.  */
-  return ferror (f) || fclose (f) != 0;
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
-  echo >>conftest.val; read $3 <conftest.val; ac_retval=0
-else
-  ac_retval=1
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-  conftest.$ac_objext conftest.beam conftest.$ac_ext
-rm -f conftest.val
-
-  fi
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-  as_fn_set_status $ac_retval
-
-} # ac_fn_c_compute_int
-
 # ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES
 # ---------------------------------------------
 # Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR
@@ -11090,7 +10903,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11093 "configure"
+#line 10906 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11196,7 +11009,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11199 "configure"
+#line 11012 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -14025,70 +13838,40 @@ $as_echo "$bfd_cv_build_exeext" >&6; }
   test x"${bfd_cv_build_exeext}" != xno && EXEEXT_FOR_BUILD=${bfd_cv_build_exeext}
 fi
 
-# Check whether --enable-64-bit-bfd was given.
-if test "${enable_64_bit_bfd+set}" = set; then :
-  enableval=$enable_64_bit_bfd; case $enableval in #(
-  yes|no) :
-     ;; #(
-  *) :
-    as_fn_error $? "bad value ${enableval} for 64-bit-bfd option" "$LINENO" 5 ;; #(
-  *) :
-     ;;
-esac
-else
-  enable_64_bit_bfd=no
-fi
-
-
-if test "x$enable_64_bit_bfd" = "xno"; then :
-    # The cast to long int works around a bug in the HP C Compiler
-# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
-# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
-# This bug is HP SR number 8606223364.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of void *" >&5
-$as_echo_n "checking size of void *... " >&6; }
-if ${ac_cv_sizeof_void_p+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (void *))" "ac_cv_sizeof_void_p"        "$ac_includes_default"; then :
-
-else
-  if test "$ac_cv_type_void_p" = yes; then
-     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error 77 "cannot compute sizeof (void *)
-See \`config.log' for more details" "$LINENO" 5; }
-   else
-     ac_cv_sizeof_void_p=0
-   fi
-fi
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_void_p" >&5
-$as_echo "$ac_cv_sizeof_void_p" >&6; }
-
-
-
-cat >>confdefs.h <<_ACEOF
-#define SIZEOF_VOID_P $ac_cv_sizeof_void_p
+# See whether 64-bit bfd lib has been enabled.
+OLD_CPPFLAGS=$CPPFLAGS
+# Put the old CPPFLAGS last, in case the user's CPPFLAGS point somewhere
+# with bfd, with -I/foo/include.  We always want our bfd.
+CPPFLAGS="-I${srcdir}/../include -I../bfd -I${srcdir}/../bfd $CPPFLAGS"
+# Note we cannot cache the result of this check because BFD64 may change
+# when a secondary target has been added or removed and we have no access
+# to this information here.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether BFD is 64-bit" >&5
+$as_echo_n "checking whether BFD is 64-bit... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include "bfd.h"
+int
+main ()
+{
+#ifdef BFD64
+HAVE_BFD64
+#endif
+  ;
+  return 0;
+}
 _ACEOF
-
-
-  if test "x$ac_cv_sizeof_void_p" = "x8"; then :
-  enable_64_bit_bfd=yes
-fi
-
-fi
-
- if test "x$enable_64_bit_bfd" = "xyes"; then
-  ENABLE_BFD_64_BIT_TRUE=
-  ENABLE_BFD_64_BIT_FALSE='#'
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "HAVE_BFD64" >/dev/null 2>&1; then :
+  have_64_bit_bfd=yes
 else
-  ENABLE_BFD_64_BIT_TRUE='#'
-  ENABLE_BFD_64_BIT_FALSE=
+  have_64_bit_bfd=no
 fi
+rm -f conftest*
 
-
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_64_bit_bfd" >&5
+$as_echo "$have_64_bit_bfd" >&6; }
+CPPFLAGS=$OLD_CPPFLAGS
 
 
 
@@ -14567,7 +14350,7 @@ if test x${all_targets} = xfalse ; then
 
 else	# all_targets is true
     archdefs=-DARCH_all
-    if test "$enable_64_bit_bfd" = "yes" ; then
+    if test "$have_64_bit_bfd" = "yes" ; then
 	BFD_MACHINES='$(ALL32_MACHINES) $(ALL64_MACHINES)'
     else
 	BFD_MACHINES='$(ALL32_MACHINES)'
@@ -14720,10 +14503,6 @@ if test -z "${INSTALL_LIBBFD_TRUE}" && test -z "${INSTALL_LIBBFD_FALSE}"; then
   as_fn_error $? "conditional \"INSTALL_LIBBFD\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
-if test -z "${ENABLE_BFD_64_BIT_TRUE}" && test -z "${ENABLE_BFD_64_BIT_FALSE}"; then
-  as_fn_error $? "conditional \"ENABLE_BFD_64_BIT\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5
-fi
 if test -z "${CGEN_MAINT_TRUE}" && test -z "${CGEN_MAINT_FALSE}"; then
   as_fn_error $? "conditional \"CGEN_MAINT\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/opcodes/configure.ac b/opcodes/configure.ac
index 4f8c7347cf7..b30f9f8b438 100644
--- a/opcodes/configure.ac
+++ b/opcodes/configure.ac
@@ -383,7 +383,7 @@ if test x${all_targets} = xfalse ; then
 
 else	# all_targets is true
     archdefs=-DARCH_all
-    if test "$enable_64_bit_bfd" = "yes" ; then
+    if test "$have_64_bit_bfd" = "yes" ; then
 	BFD_MACHINES='$(ALL32_MACHINES) $(ALL64_MACHINES)'
     else
 	BFD_MACHINES='$(ALL32_MACHINES)'


More information about the Binutils-cvs mailing list