sim: clean up bfd_vma printing

A lot of this code predates the bfd_vma format define, so we have a
random mix of casts to known types so we can printf the value.  Use
the BFD_VMA_FMT that now exists to simplify and reliability output
across different build configs.
This commit is contained in:
Mike Frysinger
2021-05-03 23:27:16 -04:00
parent 225bda24db
commit 5ee0bc23a6
18 changed files with 79 additions and 42 deletions

View File

@@ -1,3 +1,7 @@
2021-05-04 Mike Frysinger <vapier@gentoo.org>
* load.c (rx_load): Use BFD_VMA_FMT and drop casts.
2021-05-03 Simon Marchi <simon.marchi@polymtl.ca>
* trace.c (op_printf): Likewise.

View File

@@ -128,8 +128,10 @@ rx_load (bfd *prog, host_callback *callback)
base = p->p_paddr;
if (verbose > 1)
fprintf (stderr, "[load segment: lma=%08x vma=%08x size=%08x]\n",
(int) base, (int) p->p_vaddr, (int) size);
fprintf (stderr,
"[load segment: lma=%08" BFD_VMA_FMT "x vma=%08x "
"size=%08" BFD_VMA_FMT "x]\n",
base, (int) p->p_vaddr, size);
if (callback)
xprintf (callback,
"Loading section %s, size %#lx lma %08lx vma %08lx\n",
@@ -151,7 +153,7 @@ rx_load (bfd *prog, host_callback *callback)
}
if (bfd_bread (buf, size, prog) != size)
{
fprintf (stderr, "Failed to read %lx bytes\n", (long) size);
fprintf (stderr, "Failed to read %" BFD_VMA_FMT "x bytes\n", size);
continue;
}