* [PATCH/RFC] unify 64-bit bfd checks
@ 2021-12-04 5:44 Mike Frysinger
2021-12-15 12:47 ` Nick Clifton
0 siblings, 1 reply; 2+ messages in thread
From: Mike Frysinger @ 2021-12-04 5:44 UTC (permalink / raw)
To: binutils
Move the 64-bit bfd logic out of bfd/configure.ac and into bfd64.m4
under config so it can be shared between all the other subdirs.
This replaces want64 with enable_64_bit_bfd which was already being
declared, but not used directly.
---
bfd/Makefile.in | 1 +
bfd/aclocal.m4 | 1 +
bfd/configure | 77 ++++++++++++-
bfd/configure.ac | 13 +--
config/bfd64.m4 | 36 ++++++
gdb/aclocal.m4 | 1 +
gdb/config.in | 6 +-
gdb/configure | 123 ++++++++++----------
gdb/configure.ac | 29 +----
ld/Makefile.in | 1 +
ld/aclocal.m4 | 1 +
ld/configure | 214 +++++++++++++++++++----------------
ld/configure.ac | 24 +---
opcodes/Makefile.in | 1 +
opcodes/aclocal.m4 | 1 +
opcodes/config.in | 3 +
opcodes/configure | 261 ++++++++++++++++++++++++++++++++++++++++++-
opcodes/configure.ac | 3 +-
18 files changed, 578 insertions(+), 218 deletions(-)
create mode 100644 config/bfd64.m4
diff --git a/bfd/configure.ac b/bfd/configure.ac
index 09dbe40ccb7e..d65cda5d7e1b 100644
--- a/bfd/configure.ac
+++ b/bfd/configure.ac
@@ -82,13 +82,12 @@ if test x$ac_checking != x ; then
AC_DEFINE(ENABLE_CHECKING, 1, [Define if you want run-time sanity checks.])
fi
-AC_ARG_ENABLE(64-bit-bfd,
-[ --enable-64-bit-bfd 64-bit support (on hosts with narrower word sizes)],
-[case "${enableval}" in
- yes) want64=true ;;
- no) want64=false ;;
- *) AC_MSG_ERROR(bad value ${enableval} for 64-bit-bfd option) ;;
-esac],[want64=false])dnl
+BFD_64_BIT
+if test $enable_64_bit_bfd = yes ; then
+ want64=true
+else
+ want64=false
+fi
AC_ARG_ENABLE(targets,
[ --enable-targets alternative target configurations],
diff --git a/config/bfd64.m4 b/config/bfd64.m4
new file mode 100644
index 000000000000..f787625864e7
--- /dev/null
+++ b/config/bfd64.m4
@@ -0,0 +1,36 @@
+dnl
+dnl Copyright (C) 2012-2021 Free Software Foundation, Inc.
+dnl
+dnl This file is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation; either version 3 of the License, or
+dnl (at your option) any later version.
+dnl
+dnl This program is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+dnl GNU General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+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.
+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"])
+])
diff --git a/gdb/configure.ac b/gdb/configure.ac
index ada937316d73..dbc7deb1f4fd 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -165,14 +165,7 @@ AS_HELP_STRING([--enable-targets=TARGETS], [alternative target configurations]),
*) enable_targets=$enableval ;;
esac])
-# Check whether to enable 64-bit support on 32-bit hosts
-AC_ARG_ENABLE(64-bit-bfd,
-AS_HELP_STRING([--enable-64-bit-bfd], [64-bit support (on hosts with narrower word sizes)]),
-[case "${enableval}" in
- yes) want64=true ;;
- no) want64=false ;;
- *) AC_MSG_ERROR(bad value ${enableval} for 64-bit-bfd option) ;;
-esac],[want64=false])dnl
+BFD_64_BIT
# Provide defaults for some variables set by the per-host and per-target
# configuration.
@@ -221,7 +214,7 @@ do
done
# Check whether this target needs 64-bit CORE_ADDR
- if test x${want64} = xfalse; then
+ if test x${enable_64_bit_bfd} = xno; then
. ${srcdir}/../bfd/config.bfd
fi
@@ -234,23 +227,7 @@ do
done
if test x${all_targets} = xtrue; then
-
- # We want all 64-bit targets if we either:
- # - run on a 64-bit host or
- # - already require 64-bit support for some other target or
- # - the --enable-64-bit-bfd option was supplied
- # Otherwise we only support all 32-bit targets.
- #
- # NOTE: This test must be in sync with the corresponding
- # tests in BFD!
-
- if test x${want64} = xfalse; then
- AC_CHECK_SIZEOF(long)
- if test "x${ac_cv_sizeof_long}" = "x8"; then
- want64=true
- fi
- fi
- if test x${want64} = xtrue; then
+ if test x${enable_64_bit_bfd} = xyes; then
TARGET_OBS='$(ALL_TARGET_OBS) $(ALL_64_TARGET_OBS)'
else
TARGET_OBS='$(ALL_TARGET_OBS)'
diff --git a/ld/configure.ac b/ld/configure.ac
index 2b4c108749a0..5e930ab6d3bc 100644
--- a/ld/configure.ac
+++ b/ld/configure.ac
@@ -60,13 +60,8 @@ AC_ARG_ENABLE(targets,
no) enable_targets= ;;
*) enable_targets=$enableval ;;
esac])dnl
-AC_ARG_ENABLE(64-bit-bfd,
-[ --enable-64-bit-bfd 64-bit support (on hosts with narrower word sizes)],
-[case "${enableval}" in
- yes) want64=true ;;
- no) want64=false ;;
- *) AC_MSG_ERROR(bad value ${enableval} for 64-bit-bfd option) ;;
-esac],[want64=false])dnl
+
+BFD_64_BIT
AC_ARG_WITH(sysroot,
[ --with-sysroot[=DIR] Search for usr/lib et al within DIR.],
@@ -366,15 +361,6 @@ all_emul_extras=
all_libpath=
TDIRS=
-# If the host is 64-bit, then we enable 64-bit targets by default.
-# This is consistent with what ../bfd/configure.ac does.
-if test x${want64} = xfalse; then
- AC_CHECK_SIZEOF(void *)
- if test "x${ac_cv_sizeof_void_p}" = "x8"; then
- want64=true
- fi
-fi
-
elf_list_options=false
elf_shlib_list_options=false
elf_plt_unwind_list_options=false
@@ -400,11 +386,11 @@ do
EMUL=$targ_emul
fi
- if test x${want64} = xfalse; then
+ if test x${enable_64_bit_bfd} = xno; then
. ${srcdir}/../bfd/config.bfd
fi
- if test x${want64} = xtrue; then
+ if test x${enable_64_bit_bfd} = xyes; then
targ_extra_emuls="$targ_extra_emuls $targ64_extra_emuls"
targ_extra_libpath="$targ_extra_libpath $targ64_extra_libpath"
fi
@@ -539,7 +525,7 @@ AC_SUBST(TDIRS)
AM_SUBST_NOTMAKE(TDIRS)
if test x${all_targets} = xtrue; then
- if test x${want64} = xtrue; then
+ if test x${enable_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.ac b/opcodes/configure.ac
index 3e83588a2563..ccf4926678e4 100644
--- a/opcodes/configure.ac
+++ b/opcodes/configure.ac
@@ -93,6 +93,7 @@ AM_PO_SUBDIRS
. ${srcdir}/../bfd/configure.host
BFD_CC_FOR_BUILD
+BFD_64_BIT
AC_SUBST(HDEFINES)
AC_PROG_INSTALL
@@ -380,7 +381,7 @@ if test x${all_targets} = xfalse ; then
else # all_targets is true
archdefs=-DARCH_all
- if grep '#define BFD_ARCH_SIZE 64' ../bfd/bfd-in3.h > /dev/null; then
+ if test "$enable_64_bit_bfd" = "yes" ; then
BFD_MACHINES='$(ALL32_MACHINES) $(ALL64_MACHINES)'
else
BFD_MACHINES='$(ALL32_MACHINES)'
--
2.33.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH/RFC] unify 64-bit bfd checks
2021-12-04 5:44 [PATCH/RFC] unify 64-bit bfd checks Mike Frysinger
@ 2021-12-15 12:47 ` Nick Clifton
0 siblings, 0 replies; 2+ messages in thread
From: Nick Clifton @ 2021-12-15 12:47 UTC (permalink / raw)
To: Mike Frysinger, binutils
Hi Mike,
> Move the 64-bit bfd logic out of bfd/configure.ac and into bfd64.m4
> under config so it can be shared between all the other subdirs.
>
> This replaces want64 with enable_64_bit_bfd which was already being
> declared, but not used directly.
Another one that I missed - approved, please apply.
Cheers
Nick
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-12-15 12:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-04 5:44 [PATCH/RFC] unify 64-bit bfd checks Mike Frysinger
2021-12-15 12:47 ` Nick Clifton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).