aboutsummaryrefslogtreecommitdiff
path: root/opcodes
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2021-12-04 00:28:14 -0500
committerMike Frysinger <vapier@gentoo.org>2022-01-01 12:49:07 -0500
commit1d5269c994bf4af088b1a9d0ed39825541623a99 (patch)
tree427712dedcd41fc7d1d0e8f837444ec8f6c6c762 /opcodes
parent3cc8ed6aaee33355a5d911a7401db3f1b05a2714 (diff)
downloadbinutils-1d5269c994bf4af088b1a9d0ed39825541623a99.zip
binutils-1d5269c994bf4af088b1a9d0ed39825541623a99.tar.gz
binutils-1d5269c994bf4af088b1a9d0ed39825541623a99.tar.bz2
unify 64-bit bfd checks
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.
Diffstat (limited to 'opcodes')
-rw-r--r--opcodes/Makefile.in1
-rw-r--r--opcodes/aclocal.m41
-rw-r--r--opcodes/config.in3
-rwxr-xr-xopcodes/configure261
-rw-r--r--opcodes/configure.ac3
5 files changed, 265 insertions, 4 deletions
diff --git a/opcodes/Makefile.in b/opcodes/Makefile.in
index eb5306e..5d17048 100644
--- a/opcodes/Makefile.in
+++ b/opcodes/Makefile.in
@@ -114,6 +114,7 @@ subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/../bfd/acinclude.m4 \
$(top_srcdir)/../bfd/warning.m4 $(top_srcdir)/../config/acx.m4 \
+ $(top_srcdir)/../config/bfd64.m4 \
$(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/../config/gettext-sister.m4 \
$(top_srcdir)/../config/jobserver.m4 \
diff --git a/opcodes/aclocal.m4 b/opcodes/aclocal.m4
index 5ab3cf3..ac0d929 100644
--- a/opcodes/aclocal.m4
+++ b/opcodes/aclocal.m4
@@ -1170,6 +1170,7 @@ AC_SUBST([am__untar])
m4_include([../bfd/acinclude.m4])
m4_include([../bfd/warning.m4])
m4_include([../config/acx.m4])
+m4_include([../config/bfd64.m4])
m4_include([../config/depstand.m4])
m4_include([../config/gettext-sister.m4])
m4_include([../config/jobserver.m4])
diff --git a/opcodes/config.in b/opcodes/config.in
index 392cda5..4cd636e 100644
--- a/opcodes/config.in
+++ b/opcodes/config.in
@@ -80,6 +80,9 @@
/* Define to the version of this package. */
#undef PACKAGE_VERSION
+/* The size of `void *', as computed by sizeof. */
+#undef SIZEOF_VOID_P
+
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
diff --git a/opcodes/configure b/opcodes/configure
index 6708a19..d3cef60 100755
--- a/opcodes/configure
+++ b/opcodes/configure
@@ -645,6 +645,8 @@ cgendir
CGEN_MAINT_FALSE
CGEN_MAINT_TRUE
HDEFINES
+ENABLE_BFD_64_BIT_FALSE
+ENABLE_BFD_64_BIT_TRUE
EXEEXT_FOR_BUILD
CC_FOR_BUILD
MSGMERGE
@@ -806,6 +808,7 @@ enable_build_warnings
enable_maintainer_mode
enable_install_libbfd
enable_nls
+enable_64_bit_bfd
enable_cgen_maint
'
ac_precious_vars='build_alias
@@ -1456,6 +1459,7 @@ Optional Features:
sometimes confusing) to the casual installer
--enable-install-libbfd controls installation of libbfd and related headers
--disable-nls do not use Native Language Support
+ --enable-64-bit-bfd 64-bit support (on hosts with narrower word sizes)
--enable-cgen-maint=dir build cgen generated files
Optional Packages:
@@ -1903,6 +1907,189 @@ $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
@@ -10848,7 +11035,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10851 "configure"
+#line 11038 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -10954,7 +11141,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10957 "configure"
+#line 11144 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11883,6 +12070,70 @@ $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
+_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
+
+
@@ -12358,7 +12609,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)'
@@ -12511,6 +12762,10 @@ 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 3e83588..ccf4926 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)'