diff options
author | Alan Modra <amodra@gmail.com> | 2022-07-31 19:25:32 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2022-08-01 09:30:33 +0930 |
commit | 1a5178fe284547ef2abd8ae66588c9999d61c524 (patch) | |
tree | a3e10f649adb19dfc046d345a73ecf2f1befdc3f /bfd/configure | |
parent | df0e73ff9307251d179aa4158347deccc9576b85 (diff) | |
download | binutils-1a5178fe284547ef2abd8ae66588c9999d61c524.zip binutils-1a5178fe284547ef2abd8ae66588c9999d61c524.tar.gz binutils-1a5178fe284547ef2abd8ae66588c9999d61c524.tar.bz2 |
PR29348, BFD_VMA_FMT wrong
There is a problem with my commit 0e3c1eebb2, which replaced
bfd_uint64_t with uint64_t: Some hosts typedef int64_t to long long
even when long is the same size as long long. That confuses the code
choosing one of "l", "ll", or "I64" for BFD_VMA_FMT, and results in
warnings.
Write a direct configure test for the printf int64_t style instead.
This removes the last use of BFD_HOST_64BIT_LONG, so delete that.
Note that the changes to configure.com are pure guesswork.
PR 29348
* bfd-in.h (BFD_HOST_64BIT_LONG): Don't define.
(BFD_VMA_FMT): Define using BFD_INT64_FMT when 64-bit.
(bfd_vma, bfd_signed_vma): Move comments to 64-bit typedefs.
* configure.ac (BFD_HOST_64BIT_LONG): Delete.
(BFD_INT64_FMT): New config test.
* configure.com: Update similarly.
* Makefile.in: Regenerate.
* bfd-in2.h: Regenerate.
* configure: Regenerate.
Diffstat (limited to 'bfd/configure')
-rwxr-xr-x | bfd/configure | 42 |
1 files changed, 34 insertions, 8 deletions
diff --git a/bfd/configure b/bfd/configure index 590986e..35e0b78 100755 --- a/bfd/configure +++ b/bfd/configure @@ -652,11 +652,11 @@ TDEFINES SHARED_LIBADD SHARED_LDFLAGS LIBM +BFD_INT64_FMT zlibinc zlibdir EXEEXT_FOR_BUILD CC_FOR_BUILD -BFD_HOST_64BIT_LONG HDEFINES MSGMERGE MSGFMT @@ -12841,13 +12841,6 @@ if test "x${ac_cv_sizeof_void_p}" = "x8"; then host64=true fi -BFD_HOST_64BIT_LONG=0 -if test "x${ac_cv_sizeof_long}" = "x8"; then - BFD_HOST_64BIT_LONG=1 -fi - - - # Put a plausible default for CC_FOR_BUILD in Makefile. if test -z "$CC_FOR_BUILD"; then if test "x$cross_compiling" = "xno"; then @@ -13041,6 +13034,39 @@ $as_echo "#define HAVE_HIDDEN 1" >>confdefs.h fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking printf int64_t format" >&5 +$as_echo_n "checking printf int64_t format... " >&6; } +if ${bfd_cv_int64_fmt+:} false; then : + $as_echo_n "(cached) " >&6 +else + for style in I64 ll l; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #define __STDC_FORMAT_MACROS 1 + #include <stdio.h> + #include <inttypes.h> + extern char PRId64_probe[sizeof PRId64 == sizeof "${style}d" ? 1 : -1]; + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + bfd_cv_int64_fmt=${style} +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $bfd_cv_int64_fmt" >&5 +$as_echo "$bfd_cv_int64_fmt" >&6; } +BFD_INT64_FMT=\"$bfd_cv_int64_fmt\" + + # Check if linker supports --as-needed and --no-as-needed options { $as_echo "$as_me:${as_lineno-$LINENO}: checking linker --as-needed support" >&5 $as_echo_n "checking linker --as-needed support... " >&6; } |