summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bfd/Makefile.in2
-rw-r--r--bfd/bfd-in.h34
-rw-r--r--bfd/bfd-in2.h34
-rwxr-xr-xbfd/configure42
-rw-r--r--bfd/configure.ac19
-rw-r--r--bfd/configure.com30
6 files changed, 98 insertions, 63 deletions
diff --git a/bfd/Makefile.in b/bfd/Makefile.in
index d3ef4c2524..a26f74d719 100644
--- a/bfd/Makefile.in
+++ b/bfd/Makefile.in
@@ -330,7 +330,7 @@ AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
-BFD_HOST_64BIT_LONG = @BFD_HOST_64BIT_LONG@
+BFD_INT64_FMT = @BFD_INT64_FMT@
CATALOGS = @CATALOGS@
CATOBJEXT = @CATOBJEXT@
CC = @CC@
diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h
index dce682af99..9d0738a232 100644
--- a/bfd/bfd-in.h
+++ b/bfd/bfd-in.h
@@ -69,8 +69,6 @@ extern "C" {
/* The word size of the default bfd target. */
#define BFD_DEFAULT_TARGET_SIZE @bfd_default_target_size@
-#define BFD_HOST_64BIT_LONG @BFD_HOST_64BIT_LONG@
-
#include <inttypes.h>
#if BFD_ARCH_SIZE >= 64
@@ -101,42 +99,34 @@ typedef struct bfd bfd;
#ifdef BFD64
+/* Represent a target address. Also used as a generic unsigned type
+ which is guaranteed to be big enough to hold any arithmetic types
+ we need to deal with. */
typedef uint64_t bfd_vma;
+
+/* A generic signed type which is guaranteed to be big enough to hold any
+ arithmetic types we need to deal with. Can be assumed to be compatible
+ with bfd_vma in the same way that signed and unsigned ints are compatible
+ (as parameters, in assignment, etc). */
typedef int64_t bfd_signed_vma;
+
typedef uint64_t bfd_size_type;
typedef uint64_t symvalue;
-#if BFD_HOST_64BIT_LONG
-#define BFD_VMA_FMT "l"
-#elif defined (__MSVCRT__)
-#define BFD_VMA_FMT "I64"
-#else
-#define BFD_VMA_FMT "ll"
-#endif
+#define BFD_VMA_FMT @BFD_INT64_FMT@
-#ifndef fprintf_vma
-#define sprintf_vma(s,x) sprintf (s, "%016" BFD_VMA_FMT "x", x)
#define fprintf_vma(f,x) fprintf (f, "%016" BFD_VMA_FMT "x", x)
-#endif
+#define sprintf_vma(s,x) sprintf (s, "%016" BFD_VMA_FMT "x", x)
#else /* not BFD64 */
-/* Represent a target address. Also used as a generic unsigned type
- which is guaranteed to be big enough to hold any arithmetic types
- we need to deal with. */
typedef unsigned long bfd_vma;
-
-/* A generic signed type which is guaranteed to be big enough to hold any
- arithmetic types we need to deal with. Can be assumed to be compatible
- with bfd_vma in the same way that signed and unsigned ints are compatible
- (as parameters, in assignment, etc). */
typedef long bfd_signed_vma;
-
typedef unsigned long symvalue;
typedef unsigned long bfd_size_type;
-/* Print a bfd_vma x on stream s. */
#define BFD_VMA_FMT "l"
+
#define fprintf_vma(s,x) fprintf (s, "%08" BFD_VMA_FMT "x", x)
#define sprintf_vma(s,x) sprintf (s, "%08" BFD_VMA_FMT "x", x)
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index 4e1182e93d..1f0f18a7e7 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -76,8 +76,6 @@ extern "C" {
/* The word size of the default bfd target. */
#define BFD_DEFAULT_TARGET_SIZE @bfd_default_target_size@
-#define BFD_HOST_64BIT_LONG @BFD_HOST_64BIT_LONG@
-
#include <inttypes.h>
#if BFD_ARCH_SIZE >= 64
@@ -108,42 +106,34 @@ typedef struct bfd bfd;
#ifdef BFD64
+/* Represent a target address. Also used as a generic unsigned type
+ which is guaranteed to be big enough to hold any arithmetic types
+ we need to deal with. */
typedef uint64_t bfd_vma;
+
+/* A generic signed type which is guaranteed to be big enough to hold any
+ arithmetic types we need to deal with. Can be assumed to be compatible
+ with bfd_vma in the same way that signed and unsigned ints are compatible
+ (as parameters, in assignment, etc). */
typedef int64_t bfd_signed_vma;
+
typedef uint64_t bfd_size_type;
typedef uint64_t symvalue;
-#if BFD_HOST_64BIT_LONG
-#define BFD_VMA_FMT "l"
-#elif defined (__MSVCRT__)
-#define BFD_VMA_FMT "I64"
-#else
-#define BFD_VMA_FMT "ll"
-#endif
+#define BFD_VMA_FMT @BFD_INT64_FMT@
-#ifndef fprintf_vma
-#define sprintf_vma(s,x) sprintf (s, "%016" BFD_VMA_FMT "x", x)
#define fprintf_vma(f,x) fprintf (f, "%016" BFD_VMA_FMT "x", x)
-#endif
+#define sprintf_vma(s,x) sprintf (s, "%016" BFD_VMA_FMT "x", x)
#else /* not BFD64 */
-/* Represent a target address. Also used as a generic unsigned type
- which is guaranteed to be big enough to hold any arithmetic types
- we need to deal with. */
typedef unsigned long bfd_vma;
-
-/* A generic signed type which is guaranteed to be big enough to hold any
- arithmetic types we need to deal with. Can be assumed to be compatible
- with bfd_vma in the same way that signed and unsigned ints are compatible
- (as parameters, in assignment, etc). */
typedef long bfd_signed_vma;
-
typedef unsigned long symvalue;
typedef unsigned long bfd_size_type;
-/* Print a bfd_vma x on stream s. */
#define BFD_VMA_FMT "l"
+
#define fprintf_vma(s,x) fprintf (s, "%08" BFD_VMA_FMT "x", x)
#define sprintf_vma(s,x) sprintf (s, "%08" BFD_VMA_FMT "x", x)
diff --git a/bfd/configure b/bfd/configure
index 9ace0bc3fb..b9b9c74d65 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; }
diff --git a/bfd/configure.ac b/bfd/configure.ac
index aad4f3c83a..6146efb5ae 100644
--- a/bfd/configure.ac
+++ b/bfd/configure.ac
@@ -218,13 +218,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
-
-AC_SUBST(BFD_HOST_64BIT_LONG)
-
BFD_CC_FOR_BUILD
AC_CHECK_HEADERS(fcntl.h sys/file.h sys/resource.h sys/stat.h sys/types.h \
@@ -255,6 +248,18 @@ if test $bfd_cv_hidden = yes; then
[Define if your compiler supports hidden visibility.])
fi
+AC_CACHE_CHECK([printf int64_t format], [bfd_cv_int64_fmt],
+ for style in I64 ll l; do
+ [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+ #define __STDC_FORMAT_MACROS 1
+ #include <stdio.h>
+ #include <inttypes.h>
+ extern char PRId64_probe[sizeof PRId64 == sizeof "${style}d" ? 1 : -1];
+ ]])], [bfd_cv_int64_fmt=${style}], [])]
+ done)
+BFD_INT64_FMT=\"$bfd_cv_int64_fmt\"
+AC_SUBST(BFD_INT64_FMT)
+
# Check if linker supports --as-needed and --no-as-needed options
AC_CACHE_CHECK(linker --as-needed support, bfd_cv_ld_as_needed,
[bfd_cv_ld_as_needed=no
diff --git a/bfd/configure.com b/bfd/configure.com
index cc8499a458..cfff494a56 100644
--- a/bfd/configure.com
+++ b/bfd/configure.com
@@ -60,11 +60,11 @@ $DECK
ERASE(match_pos);
COPY_TEXT('64');
ENDIF;
- match_pos := SEARCH_QUIETLY('@BFD_HOST_64BIT_LONG@', FORWARD, EXACT, rang);
+ match_pos := SEARCH_QUIETLY('@BFD_INT64_FMT@', FORWARD, EXACT, rang);
IF match_pos <> 0 THEN;
POSITION(BEGINNING_OF(match_pos));
ERASE(match_pos);
- COPY_TEXT('0');
+ COPY_TEXT('"l"');
ENDIF;
match_pos := SEARCH_QUIETLY('@bfd_file_ptr@', FORWARD, EXACT, rang);
IF match_pos <> 0 THEN;
@@ -114,7 +114,31 @@ $DECK
ERASE(match_pos);
COPY_TEXT('32');
ENDIF;
- match_pos := SEARCH_QUIETLY('@BFD_HOST_64BIT_LONG@', FORWARD, EXACT, rang);
+ match_pos := SEARCH_QUIETLY('@bfd_default_target_size@', FORWARD, EXACT, rang);
+ IF match_pos <> 0 THEN;
+ POSITION(BEGINNING_OF(match_pos));
+ ERASE(match_pos);
+ COPY_TEXT('32');
+ ENDIF;
+ match_pos := SEARCH_QUIETLY('@BFD_INT64_FMT@', FORWARD, EXACT, rang);
+ IF match_pos <> 0 THEN;
+ POSITION(BEGINNING_OF(match_pos));
+ ERASE(match_pos);
+ COPY_TEXT('"ll"');
+ ENDIF;
+ match_pos := SEARCH_QUIETLY('@bfd_file_ptr@', FORWARD, EXACT, rang);
+ IF match_pos <> 0 THEN;
+ POSITION(BEGINNING_OF(match_pos));
+ ERASE(match_pos);
+ COPY_TEXT('bfd_signed_vma');
+ ENDIF;
+ match_pos := SEARCH_QUIETLY('@bfd_ufile_ptr@', FORWARD, EXACT, rang);
+ IF match_pos <> 0 THEN;
+ POSITION(BEGINNING_OF(match_pos));
+ ERASE(match_pos);
+ COPY_TEXT('bfd_vma');
+ ENDIF;
+ match_pos := SEARCH_QUIETLY('@supports_plugins@', FORWARD, EXACT, rang);
IF match_pos <> 0 THEN;
POSITION(BEGINNING_OF(match_pos));
ERASE(match_pos);