From 1d5269c994bf4af088b1a9d0ed39825541623a99 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sat, 4 Dec 2021 00:28:14 -0500 Subject: [PATCH] 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. --- bfd/Makefile.in | 1 + bfd/aclocal.m4 | 1 + bfd/configure | 77 ++++++++++++- bfd/configure.ac | 13 +-- bfd/doc/Makefile.in | 1 + 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 +- 19 files changed, 579 insertions(+), 218 deletions(-) create mode 100644 config/bfd64.m4 diff --git a/bfd/Makefile.in b/bfd/Makefile.in index a838262bc78..69a8848a6db 100644 --- a/bfd/Makefile.in +++ b/bfd/Makefile.in @@ -114,6 +114,7 @@ target_triplet = @target@ subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(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/bfd/aclocal.m4 b/bfd/aclocal.m4 index a62ee4dea66..0f8aa1d4518 100644 --- a/bfd/aclocal.m4 +++ b/bfd/aclocal.m4 @@ -1168,6 +1168,7 @@ AC_SUBST([am__untar]) ]) # _AM_PROG_TAR 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/bfd/configure b/bfd/configure index d4aa2178b29..b09702f26e1 100755 --- a/bfd/configure +++ b/bfd/configure @@ -697,6 +697,8 @@ REPORT_BUGS_TEXI REPORT_BUGS_TO PKGVERSION DEBUGDIR +ENABLE_BFD_64_BIT_FALSE +ENABLE_BFD_64_BIT_TRUE PLUGINS_FALSE PLUGINS_TRUE LARGEFILE_CPPFLAGS @@ -11084,7 +11086,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11087 "configure" +#line 11089 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11190,7 +11192,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11193 "configure" +#line 11195 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11847,11 +11849,70 @@ 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) want64=true ;; - no) want64=false ;; - *) as_fn_error $? "bad value ${enableval} for 64-bit-bfd option" "$LINENO" 5 ;; + 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 + + +if test $enable_64_bit_bfd = yes ; then + want64=true else want64=false fi @@ -15182,6 +15243,10 @@ 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 a578c3a019e..bdc2fc41527 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/bfd/doc/Makefile.in b/bfd/doc/Makefile.in index c070dd8c458..f4d1ba7d2b4 100644 --- a/bfd/doc/Makefile.in +++ b/bfd/doc/Makefile.in @@ -109,6 +109,7 @@ target_triplet = @target@ subdir = doc ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(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/config/bfd64.m4 b/config/bfd64.m4 new file mode 100644 index 00000000000..d134f1a5765 --- /dev/null +++ b/config/bfd64.m4 @@ -0,0 +1,36 @@ +dnl +dnl Copyright (C) 2012-2022 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 . +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/aclocal.m4 b/gdb/aclocal.m4 index 8c7562542f6..3ed4a58d39f 100644 --- a/gdb/aclocal.m4 +++ b/gdb/aclocal.m4 @@ -201,6 +201,7 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) m4_include([../config/acx.m4]) m4_include([../config/ax_pthread.m4]) +m4_include([../config/bfd64.m4]) m4_include([../config/debuginfod.m4]) m4_include([../config/depstand.m4]) m4_include([../config/enable.m4]) diff --git a/gdb/config.in b/gdb/config.in index 4b8f1f7e1c6..cd9f252eba1 100644 --- a/gdb/config.in +++ b/gdb/config.in @@ -685,9 +685,6 @@ /* Define to 1 if the `setpgrp' function takes no argument. */ #undef SETPGRP_VOID -/* The size of `long', as computed by sizeof. */ -#undef SIZEOF_LONG - /* The size of `long long', as computed by sizeof. */ #undef SIZEOF_LONG_LONG @@ -700,6 +697,9 @@ /* The size of `unsigned __int128', as computed by sizeof. */ #undef SIZEOF_UNSIGNED___INT128 +/* The size of `void *', as computed by sizeof. */ +#undef SIZEOF_VOID_P + /* If using the C implementation of alloca, define if you know the direction of stack growth for your system; otherwise it will be automatically deduced at runtime. diff --git a/gdb/configure b/gdb/configure index d13ab374050..429eaebe568 100755 --- a/gdb/configure +++ b/gdb/configure @@ -772,6 +772,8 @@ PKG_CONFIG_PATH PKG_CONFIG HAVE_NATIVE_GCORE_TARGET TARGET_OBS +ENABLE_BFD_64_BIT_FALSE +ENABLE_BFD_64_BIT_TRUE subdirs GDB_DATADIR DEBUGDIR @@ -6649,17 +6651,70 @@ esac fi -# Check whether to enable 64-bit support on 32-bit hosts # 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) want64=true ;; - no) want64=false ;; - *) as_fn_error $? "bad value ${enableval} for 64-bit-bfd option" "$LINENO" 5 ;; + 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 - want64=false + 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 + + # Provide defaults for some variables set by the per-host and per-target # configuration. @@ -6709,7 +6764,7 @@ fi 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 @@ -6722,55 +6777,7 @@ fi 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 - # 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 long" >&5 -$as_echo_n "checking size of long... " >&6; } -if ${ac_cv_sizeof_long+:} false; then : - $as_echo_n "(cached) " >&6 -else - if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long))" "ac_cv_sizeof_long" "$ac_includes_default"; then : - -else - if test "$ac_cv_type_long" = 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 (long) -See \`config.log' for more details" "$LINENO" 5; } - else - ac_cv_sizeof_long=0 - fi -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long" >&5 -$as_echo "$ac_cv_sizeof_long" >&6; } - - - -cat >>confdefs.h <<_ACEOF -#define SIZEOF_LONG $ac_cv_sizeof_long -_ACEOF - - - 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)' @@ -20126,6 +20133,10 @@ 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 bee78d7b61b..13e880d59a9 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/Makefile.in b/ld/Makefile.in index d159f14823f..51c62a0da7f 100644 --- a/ld/Makefile.in +++ b/ld/Makefile.in @@ -112,6 +112,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/enable.m4 \ $(top_srcdir)/../config/gettext-sister.m4 \ diff --git a/ld/aclocal.m4 b/ld/aclocal.m4 index d1823c15d06..631ead7b2ca 100644 --- a/ld/aclocal.m4 +++ b/ld/aclocal.m4 @@ -1188,6 +1188,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/enable.m4]) m4_include([../config/gettext-sister.m4]) diff --git a/ld/configure b/ld/configure index c4ba49082cd..f5c329c1f12 100755 --- a/ld/configure +++ b/ld/configure @@ -686,6 +686,8 @@ 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 @@ -2097,52 +2099,6 @@ fi } # ac_fn_cxx_try_link -# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES -# --------------------------------------------- -# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR -# accordingly. -ac_fn_c_check_decl () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - as_decl_name=`echo $2|sed 's/ *(.*//'` - as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 -$as_echo_n "checking whether $as_decl_name is declared... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -#ifndef $as_decl_name -#ifdef __cplusplus - (void) $as_decl_use; -#else - (void) $as_decl_name; -#endif -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$3=yes" -else - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_decl - # ac_fn_c_compute_int LINENO EXPR VAR INCLUDES # -------------------------------------------- # Tries to find the compile-time value of EXPR in a program that includes @@ -2325,6 +2281,52 @@ rm -f conftest.val 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 +# accordingly. +ac_fn_c_check_decl () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + as_decl_name=`echo $2|sed 's/ *(.*//'` + as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 +$as_echo_n "checking whether $as_decl_name is declared... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +#ifndef $as_decl_name +#ifdef __cplusplus + (void) $as_decl_use; +#else + (void) $as_decl_name; +#endif +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_decl cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. @@ -11452,7 +11454,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11455 "configure" +#line 11457 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11558,7 +11560,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11561 "configure" +#line 11563 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -15200,17 +15202,72 @@ if test "${enable_targets+set}" = set; then : *) enable_targets=$enableval ;; 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) want64=true ;; - no) want64=false ;; - *) as_fn_error $? "bad value ${enableval} for 64-bit-bfd option" "$LINENO" 5 ;; + 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 - want64=false + 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 + + + # Check whether --with-sysroot was given. if test "${with_sysroot+set}" = set; then : @@ -16739,47 +16796,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 - # 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 - want64=true - fi -fi - elf_list_options=false elf_shlib_list_options=false elf_plt_unwind_list_options=false @@ -16805,11 +16821,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 @@ -16962,7 +16978,7 @@ _ACEOF 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 @@ -17162,6 +17178,10 @@ 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 2b4c108749a..5e930ab6d3b 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/Makefile.in b/opcodes/Makefile.in index eb5306eaf16..5d1704872f5 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 5ab3cf3ab6f..ac0d92925fa 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 392cda5d0d9..4cd636e52ed 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 6708a193c20..d3cef604c85 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 +#include +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.$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 3e83588a256..ccf4926678e 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.39.5