Compilation still fails in the same place. -Stuart
>>> Alan Modra <amo...@gmail.com> 12/11/2014 12:48 AM >>> On Tue, Dec 09, 2014 at 12:01:41PM +1030, Alan Modra wrote: > On Mon, Dec 08, 2014 at 01:30:34PM -0700, Stuart Kemp wrote: > > > > Building binutils-2.24 fails on HPUX PA-RISC 11.31 using HP's compiler > > Yes, you need a compiler that supports "long long". I don't know if > yours does. If it does, you might need to tweak binutils/elfcomm.h > HOST_WIDEST_INT define. Let's fix this properly. Also fix a place where %lld was wrongly used to print a dwarf_vma. * configure.ac: Check for long long and sizes of long long and long. * elfcomm.h (HOST_WIDEST_INT): Test HAVE_LONG_LONG in place of __STDC_VERSION__ and __GNUC__. * strings.c (print_strings): Likewise. * dwarf.c (DWARF_VMA_FMT, DWARF_VMA_FMT_LONG): Likewise. (read_debug_line_header): Use dwarf_vmatoa to print warning. * configure: Regenerate. * config.in: Regenerate. diff --git a/binutils/configure.ac b/binutils/configure.ac index 84c287c..b85a9d2 100644 --- a/binutils/configure.ac +++ b/binutils/configure.ac @@ -124,6 +124,9 @@ case "${host}" in esac AC_SUBST(DEMANGLER_NAME) +AC_CHECK_SIZEOF([long]) +AC_CHECK_TYPES([long long], [AC_CHECK_SIZEOF(long long)]) + AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h fcntl.h sys/file.h limits.h locale.h sys/param.h wchar.h) AC_HEADER_SYS_WAIT ACX_HEADER_STRING diff --git a/binutils/dwarf.c b/binutils/dwarf.c index 4e37038..02b7668 100644 --- a/binutils/dwarf.c +++ b/binutils/dwarf.c @@ -162,17 +162,17 @@ get_encoded_value (unsigned char **pdata, return val; } -#if __STDC_VERSION__ >= 199901L || (defined(__GNUC__) && __GNUC__ >= 2) -#ifndef __MINGW32__ -#define DWARF_VMA_FMT "ll" -#define DWARF_VMA_FMT_LONG "%16.16llx" +#if defined HAVE_LONG_LONG && SIZEOF_LONG_LONG > SIZEOF_LONG +# ifndef __MINGW32__ +# define DWARF_VMA_FMT "ll" +# define DWARF_VMA_FMT_LONG "%16.16llx" +# else +# define DWARF_VMA_FMT "I64" +# define DWARF_VMA_FMT_LONG "%016I64x" +# endif #else -#define DWARF_VMA_FMT "I64" -#define DWARF_VMA_FMT_LONG "%016I64x" -#endif -#else -#define DWARF_VMA_FMT "l" -#define DWARF_VMA_FMT_LONG "%16.16lx" +# define DWARF_VMA_FMT "l" +# define DWARF_VMA_FMT_LONG "%16.16lx" #endif /* Convert a dwarf vma value into a string. Returns a pointer to a static @@ -2757,7 +2757,8 @@ read_debug_line_header (struct dwarf_section * section, /* PR 17512: file:002-117414-0.004. */ if (* end_of_sequence > end) { - warn (_("Line length %lld extends beyond end of section\n"), linfo->li_length); + warn (_("Line length %s extends beyond end of section\n"), + dwarf_vmatoa ("u", linfo->li_length)); * end_of_sequence = end; return NULL; } diff --git a/binutils/elfcomm.h b/binutils/elfcomm.h index 4fd2d6c..f7f7544 100644 --- a/binutils/elfcomm.h +++ b/binutils/elfcomm.h @@ -29,7 +29,7 @@ void error (const char *, ...) ATTRIBUTE_PRINTF_1; void warn (const char *, ...) ATTRIBUTE_PRINTF_1; -#if __STDC_VERSION__ >= 199901L || (defined(__GNUC__) && __GNUC__ >= 2) +#if defined HAVE_LONG_LONG && SIZEOF_LONG_LONG > SIZEOF_LONG /* We can't use any bfd types here since readelf may define BFD64 and objdump may not. */ #define HOST_WIDEST_INT long long diff --git a/binutils/strings.c b/binutils/strings.c index 2cf046f..7346f55 100644 --- a/binutils/strings.c +++ b/binutils/strings.c @@ -578,14 +578,14 @@ print_strings (const char *filename, FILE *stream, file_ptr address, switch (address_radix) { case 8: -#if __STDC_VERSION__ >= 199901L || (defined(__GNUC__) && __GNUC__ >= 2) +#ifdef HAVE_LONG_LONG if (sizeof (start) > sizeof (long)) { -#ifndef __MSVCRT__ +# ifndef __MSVCRT__ printf ("%7llo ", (unsigned long long) start); -#else +# else printf ("%7I64o ", (unsigned long long) start); -#endif +# endif } else #elif !BFD_HOST_64BIT_LONG @@ -597,14 +597,14 @@ print_strings (const char *filename, FILE *stream, file_ptr address, break; case 10: -#if __STDC_VERSION__ >= 199901L || (defined(__GNUC__) && __GNUC__ >= 2) +#ifdef HAVE_LONG_LONG if (sizeof (start) > sizeof (long)) { -#ifndef __MSVCRT__ +# ifndef __MSVCRT__ printf ("%7lld ", (unsigned long long) start); -#else +# else printf ("%7I64d ", (unsigned long long) start); -#endif +# endif } else #elif !BFD_HOST_64BIT_LONG @@ -616,14 +616,14 @@ print_strings (const char *filename, FILE *stream, file_ptr address, break; case 16: -#if __STDC_VERSION__ >= 199901L || (defined(__GNUC__) && __GNUC__ >= 2) +#ifdef HAVE_LONG_LONG if (sizeof (start) > sizeof (long)) { -#ifndef __MSVCRT__ +# ifndef __MSVCRT__ printf ("%7llx ", (unsigned long long) start); -#else +# else printf ("%7I64x ", (unsigned long long) start); -#endif +# endif } else #elif !BFD_HOST_64BIT_LONG -- Alan Modra Australia Development Lab, IBM _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils