BFD_VMA_FMT can't be used in format strings that need to be
translated, because the translation won't work when the type of
bfd_vma differs from the machine used to compile .pot files. We've
known about this for a long time, but patches slip through review.
So just get rid of BFD_VMA_FMT, instead using the appropriate PRId64,
PRIu64, PRIx64 or PRIo64 and SCN variants for scanf. The patch is
mostly mechanical, the only thing requiring any thought is casts
needed to preserve PRId64 output from bfd_vma values, or to preserve
one of the unsigned output formats from bfd_signed_vma values.
20 files changed:
char buf[21];
size_t len;
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)
{
len = strlen (buf);
if (len > n)
{
{
struct ar_hdr hdr;
char *hdrp = (char *) &hdr;
{
struct ar_hdr hdr;
char *hdrp = (char *) &hdr;
- bfd_size_type parsed_size;
struct areltdata *ared;
char *filename = NULL;
ufile_ptr filesize;
struct areltdata *ared;
char *filename = NULL;
ufile_ptr filesize;
errno = 0;
fmag_save = hdr.ar_fmag[0];
hdr.ar_fmag[0] = 0;
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)
{
hdr.ar_fmag[0] = fmag_save;
if (scan != 1)
{
default:
_bfd_error_handler
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;
" r_rsize (0x%x)\n"),
input_bfd, rel->r_type, rel->r_vaddr, rel->r_size);
return false;
if (SMTYP_SMTYP (aux->u.auxent.x_csect.x_smtyp) != XTY_LD)
{
BFD_ASSERT (! aux->fix_scnlen);
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)
}
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));
else
fprintf (file, "%4ld",
(long) (aux->u.auxent.x_csect.x_scnlen.p - table_base));
if (!strcmp (name, ""))
{
if (!strcmp (name, ""))
{
- sprintf (ab, "%#" BFD_VMA_FMT "x", dyn.d_tag);
+ sprintf (ab, "%#" PRIx64, (uint64_t) dyn.d_tag);
bfd_hash_traverse (&(info->info->hash->table), rx_table_map_2, info);
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)
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_entry->root.string,
- info->table_default_handler);
+ (uint64_t) info->table_default_handler);
else if (info->table_default_handler != (bfd_vma)(-1))
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");
else
fprintf (info->mapfile, " no default handler\n");
- 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");
if (info->table_handlers[idx] == (bfd_vma) (-1))
fprintf (info->mapfile, "(no handler found)\n");
else if (info->table_entries[idx])
{
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);
- 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]);
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, "%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;
for (size_t i = stub_entry->stub_offset; i < end_offset; i += 4)
{
asection *stub_sec = stub_entry->group->stub_sec;
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 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);
stub_entry->stub_offset);
if (esd->sec_type == sec_stub)
dump_stub ("Previous:", esd->u.last_ent, stub_entry->stub_offset);
&& ptr->howto->bitsize > 32
&& ptr->addend - INT32_MIN > UINT32_MAX)
{
&& 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);
}
*failedp = true;
bfd_set_error (bfd_error_bad_value);
}
len = 8 + 1 + strlen (hash->root.root.root.string) + 1 + 16 + 1;
stub_name = bfd_malloc (len);
if (stub_name != NULL)
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,
(unsigned int) input_section->id,
hash->root.root.root.string,
+ (uint64_t) rel->r_addend);
}
else
{
len = 8 + 1 + 8 + 1 + 8 + 1 + 16 + 1;
stub_name = bfd_malloc (len);
if (stub_name != NULL)
}
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),
(unsigned int) input_section->id,
(unsigned int) sym_sec->id,
(unsigned int) ELFNN_R_SYM (rel->r_info),
+ (uint64_t) rel->r_addend);
char *stub_name = bfd_malloc (len);
if (stub_name != NULL)
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,
input_section->owner->id,
input_section->id,
- char imm_buf[128];
-
- sprintf (imm_buf, "%" BFD_VMA_FMT "x", imm);
abfd = stub_entry->target_section->owner;
_bfd_error_handler
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=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
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
char timebuf[40];
time_t when = buf.st_mtime;
const char *ctime_result = (const char *) ctime (&when);
char timebuf[40];
time_t when = buf.st_mtime;
const char *ctime_result = (const char *) ctime (&when);
/* PR binutils/17605: Check for corrupt time values. */
if (ctime_result == NULL)
/* PR binutils/17605: Check for corrupt time values. */
if (ctime_result == NULL)
mode_string (buf.st_mode, modebuf);
modebuf[10] = '\0';
mode_string (buf.st_mode, modebuf);
modebuf[10] = '\0';
/* POSIX 1003.2/D11 says to skip first character (entry type). */
/* 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,
(long) buf.st_uid, (long) buf.st_gid,
+ (uint64_t) buf.st_size, timebuf);
- 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);
if (p->sec)
printf( " %s %x..%x", p->sec->name,p->offset, p->offset + p->size -1);
printf (" entries: %u\n",
(unsigned) bfd_h_get_16 (abfd, hdr->c_entries));
#ifdef BFD64
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));
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));
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));
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));
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));
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));
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));
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));
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
}
bfd_h_get_64 (abfd, hdr->c_cprs));
#endif
}
#define GNU_HASH_SECTION_NAME(filedata) \
filedata->dynamic_info_DT_MIPS_XHASH ? ".MIPS.xhash" : ".gnu.hash"
\f
#define GNU_HASH_SECTION_NAME(filedata) \
filedata->dynamic_info_DT_MIPS_XHASH ? ".MIPS.xhash" : ".gnu.hash"
\f
-/* 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
/* 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
|| (size_t) amt != amt)
{
if (reason)
|| (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);
if (amt / size != nmemb || (size_t) amt + 1 == 0)
{
if (reason)
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);
|| amt > filedata->file_size - filedata->archive_file_offset - offset)
{
if (reason)
|| 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);
if (mvar == NULL)
{
if (reason)
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);
if (fread (mvar, (size_t) size, (size_t) nmemb, filedata->handle) != nmemb)
{
if (reason)
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;
if (mvar != var)
free (mvar);
return NULL;
case DEC_5:
if (vma <= 99999)
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:
/* 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:
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);
- return printf ("%" BFD_VMA_FMT "d", vma);
+ return printf ("%" PRId64, (int64_t) (bfd_signed_vma) vma);
- return printf ("%" BFD_VMA_FMT "u", vma);
+ return printf ("%" PRIu64, (uint64_t) vma);
- return printf ("%5" BFD_VMA_FMT "u", vma);
+ return printf ("%5" PRIu64, (uint64_t) vma);
- return printf ("%" BFD_VMA_FMT "o", vma);
+ return printf ("%" PRIo64, (uint64_t) vma);
- return printf ("%5" BFD_VMA_FMT "o", vma);
+ return printf ("%5" PRIo64, (uint64_t) vma);
default:
/* FIXME: Report unrecognised mode ? */
default:
/* FIXME: Report unrecognised mode ? */
{
bfd_vma * relrs;
const char *format
{
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;
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++)
for (i = 0; i < rel_size; i++)
- printf (format, relrs[i]);
+ printf (format, (uint64_t) relrs[i]);
free (relrs);
return true;
}
free (relrs);
return true;
}
- ? "%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)
}
switch (filedata->file_header.e_machine)
bfd_vma off = rels[i].r_addend;
if ((bfd_signed_vma) off < 0)
bfd_vma off = rels[i].r_addend;
if ((bfd_signed_vma) off < 0)
- printf (" - %" BFD_VMA_FMT "x", - off);
+ printf (" - %" PRIx64, (uint64_t) -off);
- printf (" + %" BFD_VMA_FMT "x", off);
+ printf (" + %" PRIx64, (uint64_t) off);
printf ("%*c", is_32bit_elf ? 12 : 20, ' ');
if ((bfd_signed_vma) off < 0)
printf ("%*c", is_32bit_elf ? 12 : 20, ' ');
if ((bfd_signed_vma) off < 0)
- printf ("-%" BFD_VMA_FMT "x", - off);
+ printf ("-%" PRIx64, (uint64_t) -off);
- printf ("%" BFD_VMA_FMT "x", off);
+ printf ("%" PRIx64, (uint64_t) off);
}
if (filedata->file_header.e_machine == EM_SPARCV9
}
if (filedata->file_header.e_machine == EM_SPARCV9
filedata->file_name, get_file_type (filedata));
else
printf (_("\nElf file type is %s\n"), get_file_type (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,
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))
}
if (! get_program_headers (filedata))
const char *rtype;
printf ("%3u ", (unsigned) BYTE_GET (imrs [i].rela_seg));
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)
type = BYTE_GET (imrs [i].type);
rtype = elf_ia64_reloc_type (type);
if (rtype == NULL)
printf ("%-31s ", rtype);
print_vma (BYTE_GET (imrs [i].addend), FULL_HEX);
printf ("%3u ", (unsigned) BYTE_GET (imrs [i].sym_seg));
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));
if (sizeof (size_t) < sizeof (bfd_size_type)
&& (bfd_size_type) ((size_t) number) != number)
{
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);
attempting to allocate memory when the read is bound to fail. */
if (ent_size * number > filedata->file_size)
{
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)
{
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)
{
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;
}
free (e_data);
return NULL;
}
i_data = (bfd_vma *) cmalloc ((size_t) number, sizeof (*i_data));
if (i_data == NULL)
{
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;
}
free (e_data);
return NULL;
}
goto desc_size_fail;
/* FIXME: Generate an error if descsz > 8 ? */
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:
break;
case NT_VMS_LINKTIME:
printf (_(" Last modified : "));
print_vms_time (byte_get ((unsigned char *) pnote->descdata + 8, 8));
printf (_("\n Link flags : "));
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);
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);
- 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);
}
return strlen (buffer);
}
- 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);
}
printf ("%*s", width, buffer);
}
- 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_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);
table_entry = TC_GENERIC_RELAX_TABLE + fragP->fr_subtype;
pr_debug ("%s:%d: md_convert_frag, subtype: %d, fix: %d, "
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",
fragP->fr_file, fragP->fr_line,
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)
if (fragP->fr_subtype <= 0
&& fragP->fr_subtype >= arc_num_relax_opcodes)
pe (expressionS *e)
{
fprintf (stdout, " operation %d\n", e->X_op);
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 ");
if (e->X_add_symbol)
{
fprintf (stdout, " add_symbol ");
md_assemblef ("slli x%d, x%d, 0x%x", reg, reg, shift);
if (lower.X_add_number != 0)
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);
/* Discard low part and zero-extend upper immediate. */
upper_imm = ((uint32_t)upper.X_add_number >> shift);
/* 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)
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);
- sprintf (buf, "%" BFD_VMA_FMT "d", val);
+ sprintf (buf, "%" PRId64, (int64_t) val);
sb_add_string (out, buf);
}
else if (in->ptr[idx] == '"'
sb_add_string (out, buf);
}
else if (in->ptr[idx] == '"'
- 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);
symtab.limit->name = (char *) xmalloc (strlen (name) + 1);
strcpy ((char *) symtab.limit->name, name);
/* Pretty print memory amount. */
static void
/* Pretty print memory amount. */
static void
-lang_print_memory_size (bfd_vma sz)
+lang_print_memory_size (uint64_t sz)
{
if ((sz & 0x3fffffff) == 0)
{
if ((sz & 0x3fffffff) == 0)
- printf ("%10" BFD_VMA_FMT "u GB", sz >> 30);
+ printf ("%10" PRIu64 " GB", sz >> 30);
else if ((sz & 0xfffff) == 0)
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)
else if ((sz & 0x3ff) == 0)
- printf ("%10" BFD_VMA_FMT "u KB", sz >> 10);
+ printf ("%10" PRIu64 " KB", sz >> 10);
- printf (" %10" BFD_VMA_FMT "u B", sz);
+ printf (" %10" PRIu64 " B", sz);
}
/* Implement --print-memory-usage: disply per region memory usage. */
}
/* Implement --print-memory-usage: disply per region memory usage. */
printf ("%16s: ",r->name_list.name);
lang_print_memory_size (used_length);
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);
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
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)
{
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)
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));
}
else
(*info->fprintf_func) (info->stream, "%s", bfd_asymbol_name (sym));
}