aboutsummaryrefslogtreecommitdiff
path: root/sim/rl78
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2021-05-03 23:27:16 -0400
committerMike Frysinger <vapier@gentoo.org>2021-05-04 08:13:45 -0400
commit5ee0bc23a68fe2a6a7717b31fda1db878b2c9764 (patch)
tree89d9ac8cad39ef7afdf6dfa1d93a5f06b87a440f /sim/rl78
parent225bda24db9671e2087fda892f94141625836a40 (diff)
downloadfsf-binutils-gdb-5ee0bc23a68fe2a6a7717b31fda1db878b2c9764.zip
fsf-binutils-gdb-5ee0bc23a68fe2a6a7717b31fda1db878b2c9764.tar.gz
fsf-binutils-gdb-5ee0bc23a68fe2a6a7717b31fda1db878b2c9764.tar.bz2
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.
Diffstat (limited to 'sim/rl78')
-rw-r--r--sim/rl78/ChangeLog4
-rw-r--r--sim/rl78/load.c18
2 files changed, 16 insertions, 6 deletions
diff --git a/sim/rl78/ChangeLog b/sim/rl78/ChangeLog
index 9d70041..1be5181 100644
--- a/sim/rl78/ChangeLog
+++ b/sim/rl78/ChangeLog
@@ -1,3 +1,7 @@
+2021-05-04 Mike Frysinger <vapier@gentoo.org>
+
+ * load.c (rl78_load): Use BFD_VMA_FMT and drop casts.
+
2021-05-01 Mike Frysinger <vapier@gentoo.org>
* config.in, configure: Regenerate.
diff --git a/sim/rl78/load.c b/sim/rl78/load.c
index f89b5e6..c137ba6 100644
--- a/sim/rl78/load.c
+++ b/sim/rl78/load.c
@@ -128,12 +128,15 @@ rl78_load (bfd *prog, host_callback *callbacks, const char * const simname)
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 (callbacks)
xprintf (callbacks,
- "Loading section %s, size %#lx lma %08lx vma %08lx\n",
- find_section_name_by_offset (prog, p->p_offset),
+ "Loading section %s, size %#" BFD_VMA_FMT "x "
+ "lma %08" BFD_VMA_FMT "x vma %08lx\n",
+ find_section_name_by_offset (prog, p->p_offset),
size, base, p->p_vaddr);
buf = xmalloc (size);
@@ -147,13 +150,16 @@ rl78_load (bfd *prog, host_callback *callbacks, const char * const simname)
if (bfd_bread (buf, size, prog) != size)
{
- fprintf (stderr, "%s: Failed to read %lx bytes\n", simname, size);
+ fprintf (stderr, "%s: Failed to read %" BFD_VMA_FMT "x bytes\n",
+ simname, size);
continue;
}
if (base > 0xeffff || base + size > 0xeffff)
{
- fprintf (stderr, "%s, Can't load image to RAM/SFR space: 0x%lx - 0x%lx\n",
+ fprintf (stderr,
+ "%s, Can't load image to RAM/SFR space: 0x%" BFD_VMA_FMT "x "
+ "- 0x%" BFD_VMA_FMT "x\n",
simname, base, base+size);
continue;
}