diff options
-rw-r--r-- | bfd/archive.c | 6 | ||||
-rw-r--r-- | bfd/coff64-rs6000.c | 2 | ||||
-rw-r--r-- | bfd/coffcode.h | 8 | ||||
-rw-r--r-- | bfd/elf.c | 2 | ||||
-rw-r--r-- | bfd/elf32-rx.c | 23 | ||||
-rw-r--r-- | bfd/elf64-ppc.c | 6 | ||||
-rw-r--r-- | bfd/elfcode.h | 7 | ||||
-rw-r--r-- | bfd/elfnn-aarch64.c | 22 | ||||
-rw-r--r-- | binutils/bucomm.c | 6 | ||||
-rw-r--r-- | binutils/coffdump.c | 3 | ||||
-rw-r--r-- | binutils/od-xcoff.c | 34 | ||||
-rw-r--r-- | binutils/readelf.c | 133 | ||||
-rw-r--r-- | binutils/size.c | 14 | ||||
-rw-r--r-- | gas/config/tc-arc.c | 12 | ||||
-rw-r--r-- | gas/config/tc-i386.c | 4 | ||||
-rw-r--r-- | gas/config/tc-riscv.c | 10 | ||||
-rw-r--r-- | gas/macro.c | 2 | ||||
-rw-r--r-- | gprof/corefile.c | 4 | ||||
-rw-r--r-- | ld/ldlang.c | 12 | ||||
-rw-r--r-- | opcodes/s12z-dis.c | 6 |
20 files changed, 149 insertions, 167 deletions
diff --git a/bfd/archive.c b/bfd/archive.c index 9ad61ad..19d1671 100644 --- a/bfd/archive.c +++ b/bfd/archive.c @@ -192,7 +192,7 @@ _bfd_ar_sizepad (char *p, size_t n, bfd_size_type size) char buf[21]; size_t len; - snprintf (buf, sizeof (buf), "%-10" BFD_VMA_FMT "u", size); + snprintf (buf, sizeof (buf), "%-10" PRIu64, (uint64_t) size); len = strlen (buf); if (len > n) { @@ -485,7 +485,7 @@ _bfd_generic_read_ar_hdr_mag (bfd *abfd, const char *mag) { struct ar_hdr hdr; char *hdrp = (char *) &hdr; - bfd_size_type parsed_size; + uint64_t parsed_size; struct areltdata *ared; char *filename = NULL; ufile_ptr filesize; @@ -514,7 +514,7 @@ _bfd_generic_read_ar_hdr_mag (bfd *abfd, const char *mag) errno = 0; fmag_save = hdr.ar_fmag[0]; hdr.ar_fmag[0] = 0; - scan = sscanf (hdr.ar_size, "%" BFD_VMA_FMT "u", &parsed_size); + scan = sscanf (hdr.ar_size, "%" SCNu64, &parsed_size); hdr.ar_fmag[0] = fmag_save; if (scan != 1) { diff --git a/bfd/coff64-rs6000.c b/bfd/coff64-rs6000.c index ce1c518..c5dc95c 100644 --- a/bfd/coff64-rs6000.c +++ b/bfd/coff64-rs6000.c @@ -1595,7 +1595,7 @@ xcoff64_ppc_relocate_section (bfd *output_bfd, default: _bfd_error_handler - (_("%pB: relocation (%d) at (0x%" BFD_VMA_FMT "x) has wrong" + (_("%pB: relocation (%d) at (0x%" PRIx64 ") has wrong" " r_rsize (0x%x)\n"), input_bfd, rel->r_type, rel->r_vaddr, rel->r_size); return false; diff --git a/bfd/coffcode.h b/bfd/coffcode.h index 6de6ecd..0dc68a9 100644 --- a/bfd/coffcode.h +++ b/bfd/coffcode.h @@ -2495,15 +2495,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); - fprintf (file, "val %5" BFD_VMA_FMT "d", - aux->u.auxent.x_csect.x_scnlen.l); + fprintf (file, "val %5" PRId64, + (int64_t) aux->u.auxent.x_csect.x_scnlen.l); } else { fprintf (file, "indx "); if (! aux->fix_scnlen) - fprintf (file, "%4" BFD_VMA_FMT "d", - aux->u.auxent.x_csect.x_scnlen.l); + fprintf (file, "%4" PRId64, + (int64_t) aux->u.auxent.x_csect.x_scnlen.l); else fprintf (file, "%4ld", (long) (aux->u.auxent.x_csect.x_scnlen.p - table_base)); @@ -1750,7 +1750,7 @@ _bfd_elf_print_private_bfd_data (bfd *abfd, void *farg) if (!strcmp (name, "")) { - sprintf (ab, "%#" BFD_VMA_FMT "x", dyn.d_tag); + sprintf (ab, "%#" PRIx64, (uint64_t) dyn.d_tag); name = ab; } break; diff --git a/bfd/elf32-rx.c b/bfd/elf32-rx.c index 6df0214..34eb884 100644 --- a/bfd/elf32-rx.c +++ b/bfd/elf32-rx.c @@ -3972,16 +3972,17 @@ rx_table_map (struct bfd_hash_entry *vent, void *vinfo) bfd_hash_traverse (&(info->info->hash->table), rx_table_map_2, info); - fprintf (info->mapfile, "\nRX Vector Table: %s has %d entries at 0x%08" BFD_VMA_FMT "x\n\n", - tname, info->table_size, start_addr); + fprintf (info->mapfile, + "\nRX Vector Table: %s has %d entries at 0x%08" PRIx64 "\n\n", + tname, info->table_size, (uint64_t) start_addr); if (info->table_default_entry) - fprintf (info->mapfile, " default handler is: %s at 0x%08" BFD_VMA_FMT "x\n", + fprintf (info->mapfile, " default handler is: %s at 0x%08" PRIx64 "\n", info->table_default_entry->root.string, - info->table_default_handler); + (uint64_t) info->table_default_handler); else if (info->table_default_handler != (bfd_vma)(-1)) - fprintf (info->mapfile, " default handler is at 0x%08" BFD_VMA_FMT "x\n", - info->table_default_handler); + fprintf (info->mapfile, " default handler is at 0x%08" PRIx64 "\n", + (uint64_t) info->table_default_handler); else fprintf (info->mapfile, " no default handler\n"); @@ -3997,7 +3998,8 @@ rx_table_map (struct bfd_hash_entry *vent, void *vinfo) } need_elipses = 1; - fprintf (info->mapfile, " 0x%08" BFD_VMA_FMT "x [%3d] ", start_addr + 4 * idx, idx); + fprintf (info->mapfile, + " 0x%08" PRIx64 " [%3d] ", (uint64_t) start_addr + 4 * idx, idx); if (info->table_handlers[idx] == (bfd_vma) (-1)) fprintf (info->mapfile, "(no handler found)\n"); @@ -4012,12 +4014,15 @@ rx_table_map (struct bfd_hash_entry *vent, void *vinfo) else if (info->table_entries[idx]) { - fprintf (info->mapfile, "0x%08" BFD_VMA_FMT "x %s\n", info->table_handlers[idx], info->table_entries[idx]->root.string); + fprintf (info->mapfile, "0x%08" PRIx64 " %s\n", + (uint64_t) info->table_handlers[idx], + info->table_entries[idx]->root.string); } else { - fprintf (info->mapfile, "0x%08" BFD_VMA_FMT "x ???\n", info->table_handlers[idx]); + fprintf (info->mapfile, "0x%08" PRIx64 " ???\n", + (uint64_t) info->table_handlers[idx]); } } if (need_elipses) diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c index 570b356..cfcd263 100644 --- a/bfd/elf64-ppc.c +++ b/bfd/elf64-ppc.c @@ -11670,7 +11670,7 @@ dump_stub (const char *header, fprintf (stderr, "%s id = %u type = %s:%s:%s\n", header, stub_entry->id, t1, t2, t3); fprintf (stderr, "name = %s\n", stub_entry->root.string); - fprintf (stderr, "offset = 0x%" BFD_VMA_FMT "x:", stub_entry->stub_offset); + fprintf (stderr, "offset = 0x%" PRIx64 ":", stub_entry->stub_offset); for (size_t i = stub_entry->stub_offset; i < end_offset; i += 4) { asection *stub_sec = stub_entry->group->stub_sec; @@ -11736,8 +11736,8 @@ ppc_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg) fprintf (stderr, "Expected id %u, got %u\n", htab->stub_id, stub_entry->id); if (stub_entry->stub_offset < stub_entry->group->stub_sec->size) - fprintf (stderr, "Expected offset >= %" BFD_VMA_FMT "x, got %" - BFD_VMA_FMT "x\n", stub_entry->group->stub_sec->size, + fprintf (stderr, "Expected offset >= %" PRIx64 ", got %" + PRIx64 "\n", stub_entry->group->stub_sec->size, stub_entry->stub_offset); if (esd->sec_type == sec_stub) dump_stub ("Previous:", esd->u.last_ent, stub_entry->stub_offset); diff --git a/bfd/elfcode.h b/bfd/elfcode.h index 4d4cb68..39c84b4 100644 --- a/bfd/elfcode.h +++ b/bfd/elfcode.h @@ -1002,9 +1002,10 @@ elf_write_relocs (bfd *abfd, asection *sec, void *data) && ptr->howto->bitsize > 32 && ptr->addend - INT32_MIN > UINT32_MAX) { - _bfd_error_handler (_("%pB: %pA+%"BFD_VMA_FMT"x: " - "relocation addend %"BFD_VMA_FMT"x too large"), - abfd, sec, ptr->address, ptr->addend); + _bfd_error_handler (_("%pB: %pA+%" PRIx64 ": " + "relocation addend %" PRIx64 " too large"), + abfd, sec, (uint64_t) ptr->address, + (uint64_t) ptr->addend); *failedp = true; bfd_set_error (bfd_error_bad_value); } diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c index ac48a17..7b93672 100644 --- a/bfd/elfnn-aarch64.c +++ b/bfd/elfnn-aarch64.c @@ -3037,21 +3037,21 @@ elfNN_aarch64_stub_name (const asection *input_section, len = 8 + 1 + strlen (hash->root.root.root.string) + 1 + 16 + 1; stub_name = bfd_malloc (len); if (stub_name != NULL) - snprintf (stub_name, len, "%08x_%s+%" BFD_VMA_FMT "x", + snprintf (stub_name, len, "%08x_%s+%" PRIx64, (unsigned int) input_section->id, hash->root.root.root.string, - rel->r_addend); + (uint64_t) rel->r_addend); } else { len = 8 + 1 + 8 + 1 + 8 + 1 + 16 + 1; stub_name = bfd_malloc (len); if (stub_name != NULL) - snprintf (stub_name, len, "%08x_%x:%x+%" BFD_VMA_FMT "x", + snprintf (stub_name, len, "%08x_%x:%x+%" PRIx64, (unsigned int) input_section->id, (unsigned int) sym_sec->id, (unsigned int) ELFNN_R_SYM (rel->r_info), - rel->r_addend); + (uint64_t) rel->r_addend); } return stub_name; @@ -4118,10 +4118,10 @@ _bfd_aarch64_erratum_843419_stub_name (asection *input_section, char *stub_name = bfd_malloc (len); if (stub_name != NULL) - snprintf (stub_name, len, "e843419@%04x_%08x_%" BFD_VMA_FMT "x", + snprintf (stub_name, len, "e843419@%04x_%08x_%" PRIx64, input_section->owner->id, input_section->id, - offset); + (uint64_t) offset); return stub_name; } @@ -5358,15 +5358,13 @@ _bfd_aarch64_erratum_843419_branch_to_stub (struct bfd_hash_entry *gen_entry, } else { - char imm_buf[128]; - - sprintf (imm_buf, "%" BFD_VMA_FMT "x", imm); abfd = stub_entry->target_section->owner; _bfd_error_handler - (_("%pB: error: erratum 843419 immediate 0x%s " - "out of range for ADR (input file too large) and " + (_("%pB: error: erratum 843419 immediate 0x%" PRIx64 + " out of range for ADR (input file too large) and " "--fix-cortex-a53-843419=adr used. Run the linker with " - "--fix-cortex-a53-843419=full instead"), abfd, imm_buf); + "--fix-cortex-a53-843419=full instead"), + abfd, (uint64_t) (bfd_vma) imm); bfd_set_error (bfd_error_bad_value); /* This function is called inside a hashtable traversal and the error handlers called above turn into non-fatal errors. Which means this diff --git a/binutils/bucomm.c b/binutils/bucomm.c index 5834190..5c4abf9 100644 --- a/binutils/bucomm.c +++ b/binutils/bucomm.c @@ -455,7 +455,6 @@ print_arelt_descr (FILE *file, bfd *abfd, bool verbose, bool offsets) char timebuf[40]; time_t when = buf.st_mtime; const char *ctime_result = (const char *) ctime (&when); - bfd_size_type size; /* PR binutils/17605: Check for corrupt time values. */ if (ctime_result == NULL) @@ -466,11 +465,10 @@ print_arelt_descr (FILE *file, bfd *abfd, bool verbose, bool offsets) mode_string (buf.st_mode, modebuf); modebuf[10] = '\0'; - size = buf.st_size; /* POSIX 1003.2/D11 says to skip first character (entry type). */ - fprintf (file, "%s %ld/%ld %6" BFD_VMA_FMT "u %s ", modebuf + 1, + fprintf (file, "%s %ld/%ld %6" PRIu64 " %s ", modebuf + 1, (long) buf.st_uid, (long) buf.st_gid, - size, timebuf); + (uint64_t) buf.st_size, timebuf); } } diff --git a/binutils/coffdump.c b/binutils/coffdump.c index bccc395..00a32cc 100644 --- a/binutils/coffdump.c +++ b/binutils/coffdump.c @@ -366,8 +366,7 @@ dump_coff_scope (struct coff_scope *p) if (p) { tab (1); - printf ("%s %" BFD_VMA_FMT "x ", - _("List of blocks "), (bfd_vma) (uintptr_t) p); + printf ("%s %p ", _("List of blocks "), p); if (p->sec) printf( " %s %x..%x", p->sec->name,p->offset, p->offset + p->size -1); diff --git a/binutils/od-xcoff.c b/binutils/od-xcoff.c index 8c4c259..c5c8273 100644 --- a/binutils/od-xcoff.c +++ b/binutils/od-xcoff.c @@ -1686,42 +1686,42 @@ dump_dumpx_core (bfd *abfd, struct external_core_dumpx *hdr) printf (" entries: %u\n", (unsigned) bfd_h_get_16 (abfd, hdr->c_entries)); #ifdef BFD64 - printf (" fdsinfox: offset: 0x%08" BFD_VMA_FMT "x\n", + printf (" fdsinfox: offset: 0x%08" PRIx64 "\n", bfd_h_get_64 (abfd, hdr->c_fdsinfox)); - printf (" loader: offset: 0x%08" BFD_VMA_FMT "x, " - "size: 0x%" BFD_VMA_FMT"x\n", + printf (" loader: offset: 0x%08" PRIx64 ", " + "size: 0x%" PRIx64 "\n", bfd_h_get_64 (abfd, hdr->c_loader), bfd_h_get_64 (abfd, hdr->c_lsize)); - printf (" thr: offset: 0x%08" BFD_VMA_FMT "x, nbr: %u\n", + printf (" thr: offset: 0x%08" PRIx64 ", nbr: %u\n", bfd_h_get_64 (abfd, hdr->c_thr), (unsigned) bfd_h_get_32 (abfd, hdr->c_n_thr)); - printf (" segregions: offset: 0x%08" BFD_VMA_FMT "x, " - "nbr: %" BFD_VMA_FMT "u\n", + printf (" segregions: offset: 0x%08" PRIx64 ", " + "nbr: %" PRIu64 "\n", bfd_h_get_64 (abfd, hdr->c_segregion), bfd_h_get_64 (abfd, hdr->c_segs)); - printf (" stack: offset: 0x%08" BFD_VMA_FMT "x, " - "org: 0x%" BFD_VMA_FMT"x, " - "size: 0x%" BFD_VMA_FMT"x\n", + printf (" stack: offset: 0x%08" PRIx64 ", " + "org: 0x%" PRIx64 ", " + "size: 0x%" PRIx64 "\n", bfd_h_get_64 (abfd, hdr->c_stack), bfd_h_get_64 (abfd, hdr->c_stackorg), bfd_h_get_64 (abfd, hdr->c_size)); - printf (" data: offset: 0x%08" BFD_VMA_FMT "x, " - "org: 0x%" BFD_VMA_FMT"x, " - "size: 0x%" BFD_VMA_FMT"x\n", + printf (" data: offset: 0x%08" PRIx64 ", " + "org: 0x%" PRIx64 ", " + "size: 0x%" PRIx64 "\n", bfd_h_get_64 (abfd, hdr->c_data), bfd_h_get_64 (abfd, hdr->c_dataorg), bfd_h_get_64 (abfd, hdr->c_datasize)); - printf (" sdata: org: 0x%" BFD_VMA_FMT"x, " - "size: 0x%" BFD_VMA_FMT"x\n", + printf (" sdata: org: 0x%" PRIx64 ", " + "size: 0x%" PRIx64 "\n", bfd_h_get_64 (abfd, hdr->c_sdorg), bfd_h_get_64 (abfd, hdr->c_sdsize)); - printf (" vmmregions: offset: 0x%" BFD_VMA_FMT"x, " - "num: 0x%" BFD_VMA_FMT"x\n", + printf (" vmmregions: offset: 0x%" PRIx64 ", " + "num: 0x%" PRIx64 "\n", bfd_h_get_64 (abfd, hdr->c_vmm), bfd_h_get_64 (abfd, hdr->c_vmmregions)); printf (" impl: 0x%08x\n", (unsigned) bfd_h_get_32 (abfd, hdr->c_impl)); - printf (" cprs: 0x%" BFD_VMA_FMT "x\n", + printf (" cprs: 0x%" PRIx64 "\n", bfd_h_get_64 (abfd, hdr->c_cprs)); #endif } diff --git a/binutils/readelf.c b/binutils/readelf.c index 157f8d8..de572dd 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -430,30 +430,6 @@ get_dynamic_name (const Filedata *filedata, size_t offset) #define GNU_HASH_SECTION_NAME(filedata) \ filedata->dynamic_info_DT_MIPS_XHASH ? ".MIPS.xhash" : ".gnu.hash" -/* Print a BFD_VMA to an internal buffer, for use in error messages. - BFD_FMA_FMT can't be used in translated strings. */ - -static const char * -bfd_vmatoa (char *fmtch, bfd_vma value) -{ - /* bfd_vmatoa is used more then once in a printf call for output. - Cycle through an array of buffers. */ - static int buf_pos = 0; - static struct bfd_vmatoa_buf - { - char place[64]; - } buf[4]; - char *ret; - char fmt[32]; - - ret = buf[buf_pos++].place; - buf_pos %= ARRAY_SIZE (buf); - - sprintf (fmt, "%%%s%s", BFD_VMA_FMT, fmtch); - snprintf (ret, sizeof (buf[0].place), fmt, value); - return ret; -} - /* Retrieve NMEMB structures, each SIZE bytes long from FILEDATA starting at OFFSET + the offset of the current archive member, if we are examining an archive. Put the retrieved data into VAR, if it is not NULL. Otherwise @@ -484,9 +460,9 @@ get_data (void * var, || (size_t) amt != amt) { if (reason) - error (_("Size truncation prevents reading %s" - " elements of size %s for %s\n"), - bfd_vmatoa ("u", nmemb), bfd_vmatoa ("u", size), reason); + error (_("Size truncation prevents reading %" PRIu64 + " elements of size %" PRIu64 " for %s\n"), + (uint64_t) nmemb, (uint64_t) size, reason); return NULL; } @@ -494,9 +470,9 @@ get_data (void * var, if (amt / size != nmemb || (size_t) amt + 1 == 0) { if (reason) - error (_("Size overflow prevents reading %s" - " elements of size %s for %s\n"), - bfd_vmatoa ("u", nmemb), bfd_vmatoa ("u", size), reason); + error (_("Size overflow prevents reading %" PRIu64 + " elements of size %" PRIu64 " for %s\n"), + (uint64_t) nmemb, (uint64_t) size, reason); return NULL; } @@ -507,8 +483,8 @@ get_data (void * var, || amt > filedata->file_size - filedata->archive_file_offset - offset) { if (reason) - error (_("Reading %s bytes extends past end of file for %s\n"), - bfd_vmatoa ("u", amt), reason); + error (_("Reading %" PRIu64 " bytes extends past end of file for %s\n"), + (uint64_t) amt, reason); return NULL; } @@ -530,8 +506,8 @@ get_data (void * var, if (mvar == NULL) { if (reason) - error (_("Out of memory allocating %s bytes for %s\n"), - bfd_vmatoa ("u", amt), reason); + error (_("Out of memory allocating %" PRIu64 " bytes for %s\n"), + (uint64_t) amt, reason); return NULL; } @@ -541,8 +517,8 @@ get_data (void * var, if (fread (mvar, (size_t) size, (size_t) nmemb, filedata->handle) != nmemb) { if (reason) - error (_("Unable to read in %s bytes of %s\n"), - bfd_vmatoa ("u", amt), reason); + error (_("Unable to read in %" PRIu64 " bytes of %s\n"), + (uint64_t) amt, reason); if (mvar != var) free (mvar); return NULL; @@ -573,34 +549,34 @@ print_vma (bfd_vma vma, print_mode mode) case DEC_5: if (vma <= 99999) - return printf ("%5" BFD_VMA_FMT "d", vma); + return printf ("%5" PRId64, (int64_t) vma); /* Fall through. */ case PREFIX_HEX: nc = printf ("0x"); /* Fall through. */ case HEX: - return nc + printf ("%" BFD_VMA_FMT "x", vma); + return nc + printf ("%" PRIx64, (uint64_t) vma); case PREFIX_HEX_5: nc = printf ("0x"); /* Fall through. */ case HEX_5: - return nc + printf ("%05" BFD_VMA_FMT "x", vma); + return nc + printf ("%05" PRIx64, (uint64_t) vma); case DEC: - return printf ("%" BFD_VMA_FMT "d", vma); + return printf ("%" PRId64, (int64_t) (bfd_signed_vma) vma); case UNSIGNED: - return printf ("%" BFD_VMA_FMT "u", vma); + return printf ("%" PRIu64, (uint64_t) vma); case UNSIGNED_5: - return printf ("%5" BFD_VMA_FMT "u", vma); + return printf ("%5" PRIu64, (uint64_t) vma); case OCTAL: - return printf ("%" BFD_VMA_FMT "o", vma); + return printf ("%" PRIo64, (uint64_t) vma); case OCTAL_5: - return printf ("%5" BFD_VMA_FMT "o", vma); + return printf ("%5" PRIo64, (uint64_t) vma); default: /* FIXME: Report unrecognised mode ? */ @@ -1511,15 +1487,16 @@ dump_relocations (Filedata * filedata, { bfd_vma * relrs; const char *format - = is_32bit_elf ? "%08" BFD_VMA_FMT "x\n" : "%016" BFD_VMA_FMT "x\n"; + = is_32bit_elf ? "%08" PRIx64 "\n" : "%016" PRIx64 "\n"; if (!slurp_relr_relocs (filedata, rel_offset, rel_size, &relrs, &rel_size)) return false; - printf (ngettext (" %lu offset\n", " %lu offsets\n", rel_size), rel_size); + printf (ngettext (" %lu offset\n", " %lu offsets\n", rel_size), + rel_size); for (i = 0; i < rel_size; i++) - printf (format, relrs[i]); + printf (format, (uint64_t) relrs[i]); free (relrs); return true; } @@ -1582,9 +1559,9 @@ dump_relocations (Filedata * filedata, else { printf (do_wide - ? "%16.16" BFD_VMA_FMT "x %16.16" BFD_VMA_FMT "x " - : "%12.12" BFD_VMA_FMT "x %12.12" BFD_VMA_FMT "x ", - offset, inf); + ? "%16.16" PRIx64 " %16.16" PRIx64 " " + : "%12.12" PRIx64 " %12.12" PRIx64 " ", + (uint64_t) offset, (uint64_t) inf); } switch (filedata->file_header.e_machine) @@ -2089,9 +2066,9 @@ dump_relocations (Filedata * filedata, bfd_vma off = rels[i].r_addend; if ((bfd_signed_vma) off < 0) - printf (" - %" BFD_VMA_FMT "x", - off); + printf (" - %" PRIx64, (uint64_t) -off); else - printf (" + %" BFD_VMA_FMT "x", off); + printf (" + %" PRIx64, (uint64_t) off); } } } @@ -2101,9 +2078,9 @@ dump_relocations (Filedata * filedata, printf ("%*c", is_32bit_elf ? 12 : 20, ' '); if ((bfd_signed_vma) off < 0) - printf ("-%" BFD_VMA_FMT "x", - off); + printf ("-%" PRIx64, (uint64_t) -off); else - printf ("%" BFD_VMA_FMT "x", off); + printf ("%" PRIx64, (uint64_t) off); } if (filedata->file_header.e_machine == EM_SPARCV9 @@ -6031,12 +6008,15 @@ process_program_headers (Filedata * filedata) filedata->file_name, get_file_type (filedata)); else printf (_("\nElf file type is %s\n"), get_file_type (filedata)); - printf (_("Entry point 0x%s\n"), bfd_vmatoa ("x", filedata->file_header.e_entry)); - printf (ngettext ("There is %d program header, starting at offset %s\n", - "There are %d program headers, starting at offset %s\n", + printf (_("Entry point 0x%" PRIx64 "\n"), + (uint64_t) filedata->file_header.e_entry); + printf (ngettext ("There is %d program header," + " starting at offset %" PRIu64 "\n", + "There are %d program headers," + " starting at offset %" PRIu64 "\n", filedata->file_header.e_phnum), filedata->file_header.e_phnum, - bfd_vmatoa ("u", filedata->file_header.e_phoff)); + (uint64_t) filedata->file_header.e_phoff); } if (! get_program_headers (filedata)) @@ -8220,8 +8200,8 @@ dump_ia64_vms_dynamic_relocs (Filedata * filedata, struct ia64_vms_dynimgrela *i const char *rtype; printf ("%3u ", (unsigned) BYTE_GET (imrs [i].rela_seg)); - printf ("%08" BFD_VMA_FMT "x ", - (bfd_vma) BYTE_GET (imrs [i].rela_offset)); + printf ("%08" PRIx64 " ", + (uint64_t) BYTE_GET (imrs [i].rela_offset)); type = BYTE_GET (imrs [i].type); rtype = elf_ia64_reloc_type (type); if (rtype == NULL) @@ -8230,8 +8210,8 @@ dump_ia64_vms_dynamic_relocs (Filedata * filedata, struct ia64_vms_dynimgrela *i printf ("%-31s ", rtype); print_vma (BYTE_GET (imrs [i].addend), FULL_HEX); printf ("%3u ", (unsigned) BYTE_GET (imrs [i].sym_seg)); - printf ("%08" BFD_VMA_FMT "x\n", - (bfd_vma) BYTE_GET (imrs [i].sym_offset)); + printf ("%08" PRIx64 "\n", + (uint64_t) BYTE_GET (imrs [i].sym_offset)); } free (imrs); @@ -10949,8 +10929,9 @@ get_dynamic_data (Filedata * filedata, bfd_size_type number, unsigned int ent_si if (sizeof (size_t) < sizeof (bfd_size_type) && (bfd_size_type) ((size_t) number) != number) { - error (_("Size truncation prevents reading %s elements of size %u\n"), - bfd_vmatoa ("u", number), ent_size); + error (_("Size truncation prevents reading %" PRIu64 + " elements of size %u\n"), + (uint64_t) number, ent_size); return NULL; } @@ -10958,23 +10939,23 @@ get_dynamic_data (Filedata * filedata, bfd_size_type number, unsigned int ent_si attempting to allocate memory when the read is bound to fail. */ if (ent_size * number > filedata->file_size) { - error (_("Invalid number of dynamic entries: %s\n"), - bfd_vmatoa ("u", number)); + error (_("Invalid number of dynamic entries: %" PRIu64 "\n"), + (uint64_t) number); return NULL; } e_data = (unsigned char *) cmalloc ((size_t) number, ent_size); if (e_data == NULL) { - error (_("Out of memory reading %s dynamic entries\n"), - bfd_vmatoa ("u", number)); + error (_("Out of memory reading %" PRIu64 " dynamic entries\n"), + (uint64_t) number); return NULL; } if (fread (e_data, ent_size, (size_t) number, filedata->handle) != number) { - error (_("Unable to read in %s bytes of dynamic data\n"), - bfd_vmatoa ("u", number * ent_size)); + error (_("Unable to read in %" PRIu64 " bytes of dynamic data\n"), + (uint64_t) number * ent_size); free (e_data); return NULL; } @@ -10982,8 +10963,8 @@ get_dynamic_data (Filedata * filedata, bfd_size_type number, unsigned int ent_si i_data = (bfd_vma *) cmalloc ((size_t) number, sizeof (*i_data)); if (i_data == NULL) { - error (_("Out of memory allocating space for %s dynamic entries\n"), - bfd_vmatoa ("u", number)); + error (_("Out of memory allocating space for %" PRIu64 " dynamic entries\n"), + (uint64_t) number); free (e_data); return NULL; } @@ -20741,8 +20722,8 @@ print_ia64_vms_note (Elf_Internal_Note * pnote) goto desc_size_fail; /* FIXME: Generate an error if descsz > 8 ? */ - printf ("0x%016" BFD_VMA_FMT "x\n", - (bfd_vma) byte_get ((unsigned char *) pnote->descdata, 8)); + printf ("0x%016" PRIx64 "\n", + (uint64_t) byte_get ((unsigned char *) pnote->descdata, 8)); break; case NT_VMS_LINKTIME: @@ -20775,8 +20756,8 @@ print_ia64_vms_note (Elf_Internal_Note * pnote) printf (_(" Last modified : ")); print_vms_time (byte_get ((unsigned char *) pnote->descdata + 8, 8)); printf (_("\n Link flags : ")); - printf ("0x%016" BFD_VMA_FMT "x\n", - (bfd_vma) byte_get ((unsigned char *) pnote->descdata + 16, 8)); + printf ("0x%016" PRIx64 "\n", + (uint64_t) byte_get ((unsigned char *) pnote->descdata + 16, 8)); printf (_(" Header flags: 0x%08x\n"), (unsigned) byte_get ((unsigned char *) pnote->descdata + 24, 4)); printf (_(" Image id : %.*s\n"), maxlen - 32, pnote->descdata + 32); diff --git a/binutils/size.c b/binutils/size.c index 7104025..9bdafcb 100644 --- a/binutils/size.c +++ b/binutils/size.c @@ -440,10 +440,9 @@ size_number (bfd_size_type num) { char buffer[40]; - sprintf (buffer, - (radix == decimal ? "%" BFD_VMA_FMT "u" : - ((radix == octal) ? "0%" BFD_VMA_FMT "o" : "0x%" BFD_VMA_FMT "x")), - num); + sprintf (buffer, (radix == decimal ? "%" PRIu64 + : radix == octal ? "0%" PRIo64 : "0x%" PRIx64), + (uint64_t) num); return strlen (buffer); } @@ -453,10 +452,9 @@ rprint_number (int width, bfd_size_type num) { char buffer[40]; - sprintf (buffer, - (radix == decimal ? "%" BFD_VMA_FMT "u" : - ((radix == octal) ? "0%" BFD_VMA_FMT "o" : "0x%" BFD_VMA_FMT "x")), - num); + sprintf (buffer, (radix == decimal ? "%" PRIu64 + : radix == octal ? "0%" PRIo64 : "0x%" PRIx64), + (uint64_t) num); printf ("%*s", width, buffer); } diff --git a/gas/config/tc-arc.c b/gas/config/tc-arc.c index a606078..51afb79 100644 --- a/gas/config/tc-arc.c +++ b/gas/config/tc-arc.c @@ -2815,11 +2815,11 @@ md_pcrel_from_section (fixS *fixP, } } - pr_debug ("pcrel from %"BFD_VMA_FMT"x + %lx = %"BFD_VMA_FMT"x, " - "symbol: %s (%"BFD_VMA_FMT"x)\n", - fixP->fx_frag->fr_address, fixP->fx_where, base, + pr_debug ("pcrel from %" PRIx64 " + %lx = %" PRIx64 ", " + "symbol: %s (%" PRIx64 ")\n", + (uint64_t) fixP->fx_frag->fr_address, fixP->fx_where, (uint64_t) base, fixP->fx_addsy ? S_GET_NAME (fixP->fx_addsy) : "(null)", - fixP->fx_addsy ? S_GET_VALUE (fixP->fx_addsy) : 0); + fixP->fx_addsy ? (uint64_t) S_GET_VALUE (fixP->fx_addsy) : (uint64_t) 0); return base; } @@ -3311,9 +3311,9 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, table_entry = TC_GENERIC_RELAX_TABLE + fragP->fr_subtype; pr_debug ("%s:%d: md_convert_frag, subtype: %d, fix: %d, " - "var: %"BFD_VMA_FMT"d\n", + "var: %" PRId64 "\n", fragP->fr_file, fragP->fr_line, - fragP->fr_subtype, fix, fragP->fr_var); + fragP->fr_subtype, fix, (int64_t) fragP->fr_var); if (fragP->fr_subtype <= 0 && fragP->fr_subtype >= arc_num_relax_opcodes) diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index 62d583b..8a893c4 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -3185,8 +3185,8 @@ static void pe (expressionS *e) { fprintf (stdout, " operation %d\n", e->X_op); - fprintf (stdout, " add_number %" BFD_VMA_FMT "d (%" BFD_VMA_FMT "x)\n", - e->X_add_number, e->X_add_number); + fprintf (stdout, " add_number %" PRId64 " (%" PRIx64 ")\n", + (int64_t) e->X_add_number, (uint64_t) (valueT) e->X_add_number); if (e->X_add_symbol) { fprintf (stdout, " add_symbol "); diff --git a/gas/config/tc-riscv.c b/gas/config/tc-riscv.c index ecdffbe..34ce68e 100644 --- a/gas/config/tc-riscv.c +++ b/gas/config/tc-riscv.c @@ -1683,8 +1683,8 @@ load_const (int reg, expressionS *ep) md_assemblef ("slli x%d, x%d, 0x%x", reg, reg, shift); if (lower.X_add_number != 0) - md_assemblef ("addi x%d, x%d, %" BFD_VMA_FMT "d", reg, reg, - lower.X_add_number); + md_assemblef ("addi x%d, x%d, %" PRId64, reg, reg, + (int64_t) lower.X_add_number); } else { @@ -1696,13 +1696,13 @@ load_const (int reg, expressionS *ep) /* Discard low part and zero-extend upper immediate. */ upper_imm = ((uint32_t)upper.X_add_number >> shift); - md_assemblef ("lui x%d, 0x%" BFD_VMA_FMT "x", reg, upper_imm); + md_assemblef ("lui x%d, 0x%" PRIx64, reg, (uint64_t) upper_imm); hi_reg = reg; } if (lower.X_add_number != 0 || hi_reg == 0) - md_assemblef ("%s x%d, x%d, %" BFD_VMA_FMT "d", ADD32_INSN, reg, hi_reg, - lower.X_add_number); + md_assemblef ("%s x%d, x%d, %" PRId64, ADD32_INSN, reg, hi_reg, + (int64_t) lower.X_add_number); } } diff --git a/gas/macro.c b/gas/macro.c index e2cfbee..d799ba5 100644 --- a/gas/macro.c +++ b/gas/macro.c @@ -419,7 +419,7 @@ get_any_string (size_t idx, sb *in, sb *out) idx + 1, in, &val); - sprintf (buf, "%" BFD_VMA_FMT "d", val); + sprintf (buf, "%" PRId64, (int64_t) val); sb_add_string (out, buf); } else if (in->ptr[idx] == '"' diff --git a/gprof/corefile.c b/gprof/corefile.c index 2838d49..0ca32c4 100644 --- a/gprof/corefile.c +++ b/gprof/corefile.c @@ -560,7 +560,9 @@ core_create_syms_from (const char * sym_table_file) sym_init (symtab.limit); - sscanf (address, "%" BFD_VMA_FMT "x", &(symtab.limit->addr) ); + uint64_t addr; + sscanf (address, "%" SCNx64, &addr); + symtab.limit->addr = addr; symtab.limit->name = (char *) xmalloc (strlen (name) + 1); strcpy ((char *) symtab.limit->name, name); diff --git a/ld/ldlang.c b/ld/ldlang.c index 865c28b..03daba6 100644 --- a/ld/ldlang.c +++ b/ld/ldlang.c @@ -9632,16 +9632,16 @@ lang_ld_feature (char *str) /* Pretty print memory amount. */ static void -lang_print_memory_size (bfd_vma sz) +lang_print_memory_size (uint64_t sz) { if ((sz & 0x3fffffff) == 0) - printf ("%10" BFD_VMA_FMT "u GB", sz >> 30); + printf ("%10" PRIu64 " GB", sz >> 30); else if ((sz & 0xfffff) == 0) - printf ("%10" BFD_VMA_FMT "u MB", sz >> 20); + printf ("%10" PRIu64 " MB", sz >> 20); else if ((sz & 0x3ff) == 0) - printf ("%10" BFD_VMA_FMT "u KB", sz >> 10); + printf ("%10" PRIu64 " KB", sz >> 10); else - printf (" %10" BFD_VMA_FMT "u B", sz); + printf (" %10" PRIu64 " B", sz); } /* Implement --print-memory-usage: disply per region memory usage. */ @@ -9658,7 +9658,7 @@ lang_print_memory_usage (void) printf ("%16s: ",r->name_list.name); lang_print_memory_size (used_length); - lang_print_memory_size ((bfd_vma) r->length); + lang_print_memory_size (r->length); if (r->length != 0) { diff --git a/opcodes/s12z-dis.c b/opcodes/s12z-dis.c index 972aad8..4c07d5a 100644 --- a/opcodes/s12z-dis.c +++ b/opcodes/s12z-dis.c @@ -205,14 +205,14 @@ operand_separator (struct disassemble_info *info) there is no symbol. If BASE is non zero, then the a PC relative adddress is assumend (ie BASE is the value in the PC. */ static void -decode_possible_symbol (bfd_vma addr, bfd_vma base, +decode_possible_symbol (bfd_signed_vma addr, bfd_vma base, struct disassemble_info *info, bool relative) { - const char *fmt = relative ? "*%+" BFD_VMA_FMT "d" : "%" BFD_VMA_FMT "d"; + const char *fmt = relative ? "*%+" PRId64 : "%" PRId64; asymbol *sym = info->symbol_at_address_func (addr + base, info); if (!sym) - (*info->fprintf_func) (info->stream, fmt, addr); + (*info->fprintf_func) (info->stream, fmt, (int64_t) addr); else (*info->fprintf_func) (info->stream, "%s", bfd_asymbol_name (sym)); } |