diff options
-rw-r--r-- | bfd/ChangeLog | 12 | ||||
-rw-r--r-- | bfd/bfd.c | 2 | ||||
-rw-r--r-- | bfd/coff-rs6000.c | 8 | ||||
-rw-r--r-- | bfd/coff-x86_64.c | 4 | ||||
-rw-r--r-- | bfd/coffcode.h | 16 | ||||
-rw-r--r-- | bfd/elf32-score.c | 16 | ||||
-rw-r--r-- | bfd/vms-alpha.c | 2 |
7 files changed, 35 insertions, 25 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index b1e5e65..74cb0c9 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,5 +1,17 @@ 2017-07-03 Alan Modra <amodra@gmail.com> + * bfd.c (bfd_scan_vma): Don't use long long unless HAVE_LONG_LONG. + * coff-rs6000.c (FMT20): Handle hosts with 64-bit long and + Microsoft C library variant of long long format specifier. + (PRINT20): Cast value to bfd_uint64_t not long long. + * coffcode.h (coff_print_aux): Use BFD_VMA_FMT. + * coff-x86_64.c (coff_amd64_reloc): Use bfd_uint64_t rather than + long long. Don't cast to bfd_vma. + * elf32-score.c (score3_bfd_getl48): Likewise. + * vms-alpha.c (_bfd_vms_slurp_eisd): Likewise. + +2017-07-03 Alan Modra <amodra@gmail.com> + * elf.c (_bfd_elf_print_private_bfd_data): Use BFD_VMA_FMT to print d_tag. (bfd_elf_print_symbol): Don't cast symbol->flags. @@ -1363,7 +1363,7 @@ bfd_scan_vma (const char *string, const char **end, int base) if (sizeof (bfd_vma) <= sizeof (unsigned long)) return strtoul (string, (char **) end, base); -#ifdef HAVE_STRTOULL +#if defined (HAVE_STRTOULL) && defined (HAVE_LONG_LONG) if (sizeof (bfd_vma) <= sizeof (unsigned long long)) return strtoull (string, (char **) end, base); #endif diff --git a/bfd/coff-rs6000.c b/bfd/coff-rs6000.c index fabf971..3c5042f 100644 --- a/bfd/coff-rs6000.c +++ b/bfd/coff-rs6000.c @@ -1715,12 +1715,18 @@ xcoff_write_armap_old (bfd *abfd, unsigned int elength ATTRIBUTE_UNUSED, } static char buff20[XCOFFARMAGBIG_ELEMENT_SIZE + 1]; +#if BFD_HOST_64BIT_LONG +#define FMT20 "%-20ld" +#elif defined (__MSVCRT__) +#define FMT20 "%-20I64d" +#else #define FMT20 "%-20lld" +#endif #define FMT12 "%-12d" #define FMT12_OCTAL "%-12o" #define FMT4 "%-4d" #define PRINT20(d, v) \ - sprintf (buff20, FMT20, (long long)(v)), \ + sprintf (buff20, FMT20, (bfd_uint64_t)(v)), \ memcpy ((void *) (d), buff20, 20) #define PRINT12(d, v) \ diff --git a/bfd/coff-x86_64.c b/bfd/coff-x86_64.c index 928fa7f..de22822 100644 --- a/bfd/coff-x86_64.c +++ b/bfd/coff-x86_64.c @@ -182,9 +182,9 @@ coff_amd64_reloc (bfd *abfd, case 4: { - long long x = bfd_get_64 (abfd, addr); + bfd_uint64_t x = bfd_get_64 (abfd, addr); DOIT (x); - bfd_put_64 (abfd, (bfd_vma) x, addr); + bfd_put_64 (abfd, x, addr); } break; diff --git a/bfd/coffcode.h b/bfd/coffcode.h index 3331f4c..d6388d7 100644 --- a/bfd/coffcode.h +++ b/bfd/coffcode.h @@ -2599,23 +2599,15 @@ coff_print_aux (bfd *abfd ATTRIBUTE_UNUSED, if (SMTYP_SMTYP (aux->u.auxent.x_csect.x_smtyp) != XTY_LD) { BFD_ASSERT (! aux->fix_scnlen); -#ifdef XCOFF64 - fprintf (file, "val %5lld", - (long long) aux->u.auxent.x_csect.x_scnlen.l); -#else - fprintf (file, "val %5ld", (long) aux->u.auxent.x_csect.x_scnlen.l); -#endif + fprintf (file, "val %5" BFD_VMA_FMT "d", + aux->u.auxent.x_csect.x_scnlen.l); } else { fprintf (file, "indx "); if (! aux->fix_scnlen) -#ifdef XCOFF64 - fprintf (file, "%4lld", - (long long) aux->u.auxent.x_csect.x_scnlen.l); -#else - fprintf (file, "%4ld", (long) aux->u.auxent.x_csect.x_scnlen.l); -#endif + fprintf (file, "%4" BFD_VMA_FMT "d", + aux->u.auxent.x_csect.x_scnlen.l); else fprintf (file, "%4ld", (long) (aux->u.auxent.x_csect.x_scnlen.p - table_base)); diff --git a/bfd/elf32-score.c b/bfd/elf32-score.c index 5429476..3dfe806 100644 --- a/bfd/elf32-score.c +++ b/bfd/elf32-score.c @@ -227,14 +227,14 @@ static bfd_vma score3_bfd_getl48 (const void *p) { const bfd_byte *addr = p; - unsigned long long v; - - v = (unsigned long long) addr[4]; - v |= (unsigned long long) addr[5] << 8; - v |= (unsigned long long) addr[2] << 16; - v |= (unsigned long long) addr[3] << 24; - v |= (unsigned long long) addr[0] << 32; - v |= (unsigned long long) addr[1] << 40; + bfd_uint64_t v; + + v = (bfd_uint64_t) addr[4]; + v |= (bfd_uint64_t) addr[5] << 8; + v |= (bfd_uint64_t) addr[2] << 16; + v |= (bfd_uint64_t) addr[3] << 24; + v |= (bfd_uint64_t) addr[0] << 32; + v |= (bfd_uint64_t) addr[1] << 40; return v; } diff --git a/bfd/vms-alpha.c b/bfd/vms-alpha.c index a2cfa33..91e8b6e 100644 --- a/bfd/vms-alpha.c +++ b/bfd/vms-alpha.c @@ -514,7 +514,7 @@ _bfd_vms_slurp_eisd (bfd *abfd, unsigned int offset) struct vms_eisd *eisd; unsigned int rec_size; unsigned int size; - unsigned long long vaddr; + bfd_uint64_t vaddr; unsigned int flags; unsigned int vbn; char *name = NULL; |