[PATCH] Fix 64-bit BFD detection causing build failures

Maciej W. Rozycki macro@redhat.com
Wed Feb 12 18:36:39 GMT 2025


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/.

The "ac_cv_" prefix is the namespace reserved by autoconf for own use, 
so choose "bfd_cv_" for the cache variable.  It is safe to use one here, 
because the setting of BFD64 will only ever change if the configured 
host or target does and that triggers a consistency check such as:

configure: loading cache ./config.cache
configure: error: `target_alias' has changed since the previous run:
configure:   former value:  `riscv64-linux-gnu'
configure:   current value: `i386-linux-gnu'
configure: error: in `.../libiberty':
configure: error: changes in the environment can compromise the build
configure: error: run `make distclean' and/or `rm ./config.cache' and start over

and the cache will have to be removed to proceed.

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.
---
Hi,

 Verified for binutils and GDB by building with a `powerpc64le-linux-gnu' 
build and `i386-linux-gnu' and `mips-linux-gnu' native hosts, and then the 
same build and hosts and the `riscv64-linux-gnu' target (and verifying in 
opcodes/config.log that 64-bit BFD has or hasn't been detected, according 
to the expectation) with and without `--enable-targets=all'.

 For binutils also verified via regression testing across my usual set of 
targets (currently counting 238), with `--enable-targets=all'.

 OK to apply?

  Maciej
---
 Makefile.def         |    4 
 Makefile.in          |   40 +++----
 bfd/configure        |   60 ----------
 bfd/configure.ac     |    8 +
 config/bfd64.m4      |   40 ++++---
 gdb/configure        |  115 ++++++--------------
 gdb/configure.ac     |   15 --
 gdb/configure.tgt    |    8 -
 ld/configure         |  289 ++++++---------------------------------------------
 ld/configure.ac      |    6 -
 opcodes/configure    |  285 ++++++--------------------------------------------
 opcodes/configure.ac |    2 
 12 files changed, 174 insertions(+), 698 deletions(-)

binutils-gdb-bfd64.diff
Index: binutils-gdb/Makefile.def
===================================================================
--- binutils-gdb.orig/Makefile.def
+++ binutils-gdb/Makefile.def
@@ -523,7 +523,7 @@ dependencies = { module=install-bfd; on=
 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;
 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; };
Index: binutils-gdb/Makefile.in
===================================================================
--- binutils-gdb.orig/Makefile.in
+++ binutils-gdb/Makefile.in
@@ -67369,16 +67369,16 @@ install-strip-ld: maybe-install-strip-bf
 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
 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-
 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
Index: binutils-gdb/bfd/configure
===================================================================
--- binutils-gdb.orig/bfd/configure
+++ binutils-gdb/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
   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
Index: binutils-gdb/bfd/configure.ac
===================================================================
--- binutils-gdb.orig/bfd/configure.ac
+++ binutils-gdb/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
Index: binutils-gdb/config/bfd64.m4
===================================================================
--- binutils-gdb.orig/config/bfd64.m4
+++ binutils-gdb/config/bfd64.m4
@@ -16,21 +16,27 @@ dnl along with this program; see the fil
 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"
+AC_CACHE_CHECK([whether BFD is 64-bit], [bfd_cv_64_bit],
+  [AC_EGREP_CPP(
+    [HAVE_BFD64],
+    AC_LANG_PROGRAM(
+      [#include "bfd.h"],
+      [dnl
+#ifdef BFD64
+HAVE_BFD64
+#endif]),
+    [bfd_cv_64_bit=yes],
+    [bfd_cv_64_bit=no])])
+if test $bfd_cv_64_bit = yes; then
+  have_64_bit_bfd=yes
+else
+  have_64_bit_bfd=no
+fi
+CPPFLAGS=$OLD_CPPFLAGS])
Index: binutils-gdb/gdb/configure
===================================================================
--- binutils-gdb.orig/gdb/configure
+++ binutils-gdb/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
@@ -1645,7 +1642,6 @@ if test -n "$ac_init_help"; then
   --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
@@ -11500,7 +11496,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11503 "configure"
+#line 11499 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11606,7 +11602,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11609 "configure"
+#line 11605 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -24876,70 +24872,46 @@ 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 :
+# 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"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether BFD is 64-bit" >&5
+$as_echo_n "checking whether BFD is 64-bit... " >&6; }
+if ${bfd_cv_64_bit+:} 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
+  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
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "HAVE_BFD64" >/dev/null 2>&1; then :
+  bfd_cv_64_bit=yes
+else
+  bfd_cv_64_bit=no
 fi
+rm -f conftest*
 
 fi
-
- if test "x$enable_64_bit_bfd" = "xyes"; then
-  ENABLE_BFD_64_BIT_TRUE=
-  ENABLE_BFD_64_BIT_FALSE='#'
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $bfd_cv_64_bit" >&5
+$as_echo "$bfd_cv_64_bit" >&6; }
+if test $bfd_cv_64_bit = yes; then
+  have_64_bit_bfd=yes
 else
-  ENABLE_BFD_64_BIT_TRUE='#'
-  ENABLE_BFD_64_BIT_FALSE=
+  have_64_bit_bfd=no
 fi
-
-
+CPPFLAGS=$OLD_CPPFLAGS
 
 # Provide defaults for some variables set by the per-host and per-target
 # configuration.
@@ -24989,7 +24961,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
 
@@ -25002,19 +24974,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
 
@@ -33895,10 +33858,6 @@ if test -z "${MAINTAINER_MODE_TRUE}" &&
   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
Index: binutils-gdb/gdb/configure.ac
===================================================================
--- binutils-gdb.orig/gdb/configure.ac
+++ binutils-gdb/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
 
Index: binutils-gdb/gdb/configure.tgt
===================================================================
--- binutils-gdb.orig/gdb/configure.tgt
+++ binutils-gdb/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}"
@@ -578,7 +578,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}"
Index: binutils-gdb/ld/configure
===================================================================
--- binutils-gdb.orig/ld/configure
+++ binutils-gdb/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 @@ if test -n "$ac_init_help"; then
   --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,46 @@ fi
 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 :
+# 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"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether BFD is 64-bit" >&5
+$as_echo_n "checking whether BFD is 64-bit... " >&6; }
+if ${bfd_cv_64_bit+:} 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
+  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
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "HAVE_BFD64" >/dev/null 2>&1; then :
+  bfd_cv_64_bit=yes
+else
+  bfd_cv_64_bit=no
 fi
+rm -f conftest*
 
 fi
-
- if test "x$enable_64_bit_bfd" = "xyes"; then
-  ENABLE_BFD_64_BIT_TRUE=
-  ENABLE_BFD_64_BIT_FALSE='#'
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $bfd_cv_64_bit" >&5
+$as_echo "$bfd_cv_64_bit" >&6; }
+if test $bfd_cv_64_bit = yes; then
+  have_64_bit_bfd=yes
 else
-  ENABLE_BFD_64_BIT_TRUE='#'
-  ENABLE_BFD_64_BIT_FALSE=
+  have_64_bit_bfd=no
 fi
-
-
+CPPFLAGS=$OLD_CPPFLAGS
 
 
 # Check whether --with-sysroot was given.
@@ -19306,11 +19095,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 +19323,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 +19526,6 @@ if test -z "${am__fastdepCXX_TRUE}" && t
   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
Index: binutils-gdb/ld/configure.ac
===================================================================
--- binutils-gdb.orig/ld/configure.ac
+++ binutils-gdb/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
Index: binutils-gdb/opcodes/configure
===================================================================
--- binutils-gdb.orig/opcodes/configure
+++ binutils-gdb/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 @@ if test -n "$ac_init_help"; then
   --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,46 @@ $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 :
+# 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"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether BFD is 64-bit" >&5
+$as_echo_n "checking whether BFD is 64-bit... " >&6; }
+if ${bfd_cv_64_bit+:} 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
+  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
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "HAVE_BFD64" >/dev/null 2>&1; then :
+  bfd_cv_64_bit=yes
+else
+  bfd_cv_64_bit=no
 fi
+rm -f conftest*
 
 fi
-
- if test "x$enable_64_bit_bfd" = "xyes"; then
-  ENABLE_BFD_64_BIT_TRUE=
-  ENABLE_BFD_64_BIT_FALSE='#'
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $bfd_cv_64_bit" >&5
+$as_echo "$bfd_cv_64_bit" >&6; }
+if test $bfd_cv_64_bit = yes; then
+  have_64_bit_bfd=yes
 else
-  ENABLE_BFD_64_BIT_TRUE='#'
-  ENABLE_BFD_64_BIT_FALSE=
+  have_64_bit_bfd=no
 fi
-
-
+CPPFLAGS=$OLD_CPPFLAGS
 
 
 
@@ -14567,7 +14356,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 +14509,6 @@ if test -z "${INSTALL_LIBBFD_TRUE}" && t
   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
Index: binutils-gdb/opcodes/configure.ac
===================================================================
--- binutils-gdb.orig/opcodes/configure.ac
+++ binutils-gdb/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 mailing list